/* ── Auth Gate ────────────────────────────────────────────────────────────── */

#auth-gate {
    position: fixed;
    inset: 0;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    z-index: 100;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

#auth-gate.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-md);
    border-radius: 14px;
    padding: 32px 28px 28px;
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
}

.auth-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    text-align: center;
}

.auth-lock {
    width: 46px;
    height: 46px;
    background: var(--bg-raised);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.auth-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-1);
    letter-spacing: 0.03em;
}

.auth-subtitle {
    font-size: 12px;
    color: var(--text-2);
    line-height: 1.5;
}

/* ── Token field ──────────────────────────────────────────────────────────── */

.auth-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.auth-field label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.token-row {
    display: flex;
    gap: 8px;
    align-items: center;
}

#token-input {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', 'Fira Mono', monospace;
    font-size: 16px;
    color: var(--text-1);
    background: var(--bg-raised);
    border: 1px solid var(--border-md);
    border-radius: 8px;
    padding: 9px 13px;
    outline: none;
    letter-spacing: 0.05em;
    transition: border-color 0.15s, box-shadow 0.15s;
}

#token-input::placeholder {
    color: var(--text-2);
    opacity: 0.5;
    font-family: inherit;
    letter-spacing: 0;
}

#token-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 93, 10, 0.12);
}

#token-input.shake {
    animation: auth-shake 0.38s ease;
    border-color: #c0392b;
    box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.12);
}

.btn-peek {
    padding: 9px 11px;
    font-size: 13px;
    color: var(--text-2);
    background: var(--bg-raised);
    border: 1px solid var(--border-md);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.12s, border-color 0.12s;
    flex-shrink: 0;
    line-height: 1;
}

.btn-peek:hover {
    background: var(--bg-hover);
    border-color: var(--border-strong);
}

/* ── Unlock button ────────────────────────────────────────────────────────── */

.btn-auth {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    background: var(--accent);
    border: none;
    border-radius: 9px;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
    letter-spacing: 0.02em;
}

.btn-auth:hover {
    opacity: 0.88;
    transform: translateY(-1px);
}

.btn-auth:active {
    transform: translateY(0);
}

.btn-auth:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* ── Status messages ──────────────────────────────────────────────────────── */

.auth-error {
    display: none;
    font-size: 11.5px;
    color: #c0392b;
    background: rgba(192, 57, 43, 0.07);
    border: 1px solid rgba(192, 57, 43, 0.2);
    border-radius: 7px;
    padding: 8px 12px;
    text-align: center;
}

.auth-error.visible {
    display: block;
}

.auth-remembered {
    display: none;
    align-items: center;
    gap: 7px;
    font-size: 11.5px;
    color: #2d8a4e;
    background: rgba(45, 138, 78, 0.07);
    border: 1px solid rgba(45, 138, 78, 0.2);
    border-radius: 7px;
    padding: 8px 12px;
    justify-content: center;
}

.auth-remembered.visible {
    display: flex;
}

/* ── App shell visibility ─────────────────────────────────────────────────── */

#app-shell {
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

#app-shell.visible {
    opacity: 1;
    visibility: visible;
}

/* ── Header actions group ─────────────────────────────────────────────────── */

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* ── Authenticated badge ──────────────────────────────────────────────────── */

.auth-badge {
    display: none;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    font-weight: 500;
    color: #2d8a4e;
    background: rgba(45, 138, 78, 0.08);
    border: 1px solid rgba(45, 138, 78, 0.2);
    border-radius: 6px;
    padding: 4px 9px;
    cursor: pointer;
    transition: background 0.12s;
    white-space: nowrap;
}

.auth-badge.visible {
    display: flex;
}

.auth-badge:hover {
    background: rgba(45, 138, 78, 0.14);
}

.auth-badge-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #2d8a4e;
}

/* ── Shake animation ──────────────────────────────────────────────────────── */

@keyframes auth-shake {

    0%,
    100% {
        transform: translateX(0);
    }

    18% {
        transform: translateX(-6px);
    }

    36% {
        transform: translateX(6px);
    }

    54% {
        transform: translateX(-4px);
    }

    72% {
        transform: translateX(4px);
    }

    90% {
        transform: translateX(-2px);
    }
}

/* ── Mobile ───────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .auth-card {
        padding: 20px 16px 18px;
        gap: 14px;
    }

    .auth-lock {
        width: 40px;
        height: 40px;
        font-size: 18px;
    }
}