:root {
    /* Fallbacks caso o theme.js demore (opcional, pois global.css já define) */
    --primary: #0d6efd;
}

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
}

.login-container {
    background: var(--bg-card);
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    width: 100%;
    max-width: 380px;
    text-align: center;
}

.logo-area { margin-bottom: 30px; }
.logo-area img { max-height: 60px; max-width: 100%; }
.logo-area h2 { margin: 10px 0 0; color: var(--primary); font-size: 1.5rem; }

.input-group { margin-bottom: 20px; text-align: left; color: var(--text-main); }
.input-group label { display: block; font-size: 0.9rem; color: var(--text-muted); margin-bottom: 5px; font-weight: 500; }

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 12px;
    color: var(--text-muted);
    opacity: 0.7;
}

.input-wrapper input {
    width: 100%;
    padding: 12px 12px 12px 35px; /* Espaço para o ícone */
    border: 1px solid var(--border-color);
    background-color: var(--bg-card);
    color: var(--text-main);
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.input-wrapper input:focus { border-color: var(--primary); }

.toggle-pass {
    left: auto !important;
    right: 12px;
    cursor: pointer;
}

.actions {
    display: flex;
    justify-content: space-between;
    margin-bottom: 25px;
    font-size: 0.9rem;
}
.actions a { color: var(--text-muted); text-decoration: none; }
.actions a:hover { color: var(--primary); text-decoration: underline; }

button {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
    margin-bottom: 10px;
}

.btn-primary { background-color: var(--primary); color: #fff; }
.btn-primary:hover { opacity: 0.9; }

.btn-secondary { background-color: rgba(0,0,0,0.05); color: var(--text-main); }
.btn-secondary:hover { background-color: rgba(0,0,0,0.1); }

.msg-erro {
    margin-top: 15px;
    padding: 10px;
    border-radius: 6px;
    background-color: #fdecea;
    color: #dc3545;
    font-size: 0.9rem;
    border: 1px solid #f5c6cb;
}

/* Lista de Perfis */
.profile-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.profile-btn {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    color: var(--text-main);
    padding: 15px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 10px;
    transition: all 0.2s;
}
.profile-btn:hover { border-color: var(--primary); background-color: rgba(var(--primary-rgb), 0.05); }
.profile-btn i { color: var(--primary); font-size: 1.2rem; }

.alert-box {
    background: #fff3cd;
    color: #856404;
    padding: 10px;
    border-radius: 6px;
    margin-bottom: 20px;
    font-size: 0.9rem;
}

.hidden { display: none !important; }
.fade-in { animation: fadeIn 0.3s ease-in; }
@keyframes fadeIn { from { opacity:0; } to { opacity:1; } }

.cadastro-doc-titulo {
    margin: 0 0 16px;
    font-size: 0.95rem;
    color: var(--text-muted);
}

.cadastro-doc-status {
    margin: -8px 0 12px;
    font-size: 0.9rem;
    color: var(--primary);
    text-align: center;
}

.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
}

/* Mantém o aviso genérico sempre acima do modal de termos. */
#modal-overlay {
    z-index: 1300;
}

#modal-termos-overlay {
    z-index: 1200;
}

.modal-dialog {
    background: var(--bg-card);
    color: var(--text-main);
    border-radius: 12px;
    padding: 24px;
    max-width: 360px;
    width: 100%;
    text-align: center;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.modal-titulo {
    margin: 0 0 12px;
    font-size: 1.1rem;
    color: var(--text-main);
}

.modal-texto {
    margin: 0 0 20px;
    font-size: 0.95rem;
    line-height: 1.45;
    text-align: left;
}

.modal-dialog .btn-primary {
    margin-bottom: 0;
}

.terms-dialog {
    max-width: 460px;
    text-align: left;
}

.terms-message {
    text-align: left;
    margin-bottom: 12px;
}

.terms-link-text {
    margin: 0 0 14px;
    font-size: 0.95rem;
}

.terms-link-text a {
    color: var(--primary);
    font-weight: 600;
    text-decoration: underline;
}

.terms-checkbox-wrap {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 16px;
}

.terms-checkbox-wrap input[type="checkbox"] {
    margin-top: 3px;
}

.terms-checkbox-wrap label {
    font-size: 0.9rem;
    line-height: 1.4;
}

.terms-actions {
    display: flex;
    gap: 10px;
}

.terms-actions .btn-secondary,
.terms-actions .btn-primary {
    margin-bottom: 0;
}

/* --- PWA / INSTALL PROMPTS (layout inspirado no investidoresln) --- */
.pwa-install-banner {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 400px;
    background: #1a1a1a;
    color: #fff;
    padding: 16px 20px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    z-index: 9999;
    border: 1px solid rgba(13, 110, 253, 0.35);
    animation: slideUpPwa 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pwa-content {
    display: flex;
    flex-direction: column;
    text-align: left;
    flex: 1;
}

.pwa-content strong {
    color: var(--primary);
    font-size: 15px;
    margin-bottom: 2px;
}

.pwa-content small {
    font-size: 12px;
    color: #e0e0e0;
    line-height: 1.3;
}

.btn-pwa-action {
    background: var(--primary);
    color: #fff;
    border: none;
    padding: 10px 20px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 13px;
    cursor: pointer;
    white-space: nowrap;
    box-shadow: 0 4px 10px rgba(13, 110, 253, 0.3);
    transition: transform 0.2s, opacity 0.2s;
}

.btn-pwa-action:hover {
    opacity: 0.9;
}

.btn-pwa-action:active {
    transform: scale(0.95);
}

.ios-install-prompt {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 90%;
    max-width: 380px;
    background: rgba(255, 255, 255, 0.98);
    color: #1a1a1a;
    padding: 20px;
    border-radius: 16px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    text-align: center;
    font-size: 14px;
    border: 1px solid var(--primary);
    animation: slideUpPwa 0.5s ease-out;
}

.ios-install-prompt span.title {
    display: block;
    font-weight: 800;
    color: var(--primary);
    margin-bottom: 8px;
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ios-icon {
    vertical-align: middle;
    font-size: 20px;
    margin: 0 4px;
    color: #007aff;
}

.ios-close-btn {
    background: none;
    border: none;
    color: #666;
    margin-top: 10px;
    font-size: 11px;
    text-decoration: underline;
    cursor: pointer;
    padding: 0;
}

@keyframes slideUpPwa {
    from { transform: translate(-50%, 100px); opacity: 0; }
    to { transform: translate(-50%, 0); opacity: 1; }
}

@media (max-width: 768px) {
    .pwa-install-banner,
    .ios-install-prompt {
        width: calc(100% - 40px);
        bottom: 25px;
    }
}