/* ============================================================
   Onboarding Screen
   ============================================================ */
.onboarding-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    padding: 20px;
}
.onboarding-container {
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0,0,0,.1);
    max-width: 700px;
    width: 100%;
    position: relative;
    padding: 36px 40px;
    max-height: 90vh;
    overflow-y: auto;
}
.onboarding-header {
    text-align: center;
    margin-bottom: 24px;
}
.onboarding-back-top {
    display: block;
    background: none;
    border: 1px solid var(--border, #e2e8f0);
    color: var(--primary);
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    padding: 8px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    transition: background 0.2s;
}
.onboarding-back-top:hover { background: #f3f4f6; }
.onboarding-logo {
    height: 48px;
    width: auto;
    object-fit: contain;
    margin-bottom: 16px;
}
.onboarding-header h1 { font-size: 22px; margin: 0 0 6px; color: #1a1a2e; }
.onboarding-header p { color: #6b7280; margin: 0; font-size: 0.92rem; }
.onboarding-step h2 { font-size: 18px; margin: 0 0 20px; color: #1a1a2e; }

/* Progress bar */
.ob-progress {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    margin-bottom: 24px;
}
.ob-progress-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    position: relative;
}
.ob-progress-step span {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.82rem;
    background: #e5e7eb;
    color: #9ca3af;
    transition: all 0.2s;
}
.ob-progress-step small {
    font-size: 0.68rem;
    color: #9ca3af;
    font-weight: 500;
}
.ob-progress-step.active span { background: var(--primary, #3b82f6); color: #fff; }
.ob-progress-step.active small { color: var(--primary, #3b82f6); font-weight: 600; }
.ob-progress-step.done span { background: #10b981; color: #fff; }
.ob-progress-step.done small { color: #10b981; }
.ob-progress-line {
    flex: 1;
    height: 2px;
    background: #e5e7eb;
    margin: 0 8px;
    max-width: 80px;
    margin-bottom: 18px;
}

/* Invitation banner */
.ob-inv-banner {
    background: #dbeafe;
    border: 1px solid #93c5fd;
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 16px;
    font-size: 0.85rem;
    color: #1e40af;
    text-align: center;
}

/* Options grid */
.onboarding-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.ob-options-5 {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
}
.onboarding-option {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    background: #fff;
    cursor: pointer;
    transition: all .2s;
    text-align: center;
    gap: 6px;
}
.onboarding-option:hover {
    border-color: #3b82f6;
    background: #f0f7ff;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(59,130,246,.15);
}
.onboarding-option-icon { font-size: 28px; }
.onboarding-option-title { font-weight: 600; font-size: 14px; color: #1a1a2e; }
.onboarding-option-desc { font-size: 11px; color: #6b7280; line-height: 1.4; }

/* Form grid */
.ob-form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 16px;
    margin-bottom: 16px;
}
.ob-form-grid-3col {
    grid-template-columns: auto 1fr 1fr;
}
.ob-form-grid-addr {
    grid-template-columns: 1fr auto;
}
.ob-field-direccion {
    min-width: 0;
}
.ob-field-numero {
    width: 80px;
    flex-shrink: 0;
}
.ob-field-numero input {
    width: 80px !important;
}
.ob-form-grid .form-group { margin-bottom: 0; }
.ob-form-grid .form-group label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 3px;
}
.ob-form-grid .form-group input,
.ob-form-grid .form-group select {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.85rem;
    color: #1e293b;
    box-sizing: border-box;
    font-family: inherit;
}
.ob-form-grid .form-group input:focus,
.ob-form-grid .form-group select:focus {
    outline: none;
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59,130,246,.15);
}
.ob-form-grid .form-group input:disabled,
.ob-form-grid .form-group input[readonly] {
    background: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}
.form-group-short { max-width: 140px; }
.form-group-full { grid-column: 1 / -1; }

.ob-section-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #475569;
    margin: 16px 0 8px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

/* Tipo de vía + dirección */
.ob-via-wrap {
    display: flex;
    gap: 6px;
}
.ob-tipo-via {
    width: 120px !important;
    min-width: 120px;
    flex: 0 0 120px;
    padding: 7px 6px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 0.82rem;
    background: #fff;
}
.ob-via-wrap input {
    flex: 1;
    min-width: 0;
}
.ob-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    gap: 12px;
}

/* OTP Section */
.ob-otp-section {
    margin-top: 24px;
    border-top: 1px solid #e5e7eb;
    padding-top: 20px;
}
.ob-otp-section h3 {
    font-size: 1rem;
    margin: 0 0 16px;
    color: #1e293b;
}
.ob-otp-channels {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}
.ob-otp-channel {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    text-align: center;
}
.ob-otp-channel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    font-weight: 600;
    font-size: 0.88rem;
}
.ob-otp-status {
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: #fef3c7;
    color: #92400e;
}
.ob-otp-status.verified {
    background: #d1fae5;
    color: #065f46;
}
.ob-otp-input-row {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin: 12px 0 8px;
}
.ob-otp-cell {
    width: 38px;
    height: 44px;
    text-align: center;
    font-size: 1.2rem;
    font-weight: 700;
    border: 2px solid #d1d5db;
    border-radius: 8px;
    outline: none;
    transition: border-color 0.15s;
}
.ob-otp-cell:focus {
    border-color: var(--primary, #3b82f6);
    box-shadow: 0 0 0 2px rgba(59,130,246,.15);
}
.ob-otp-timer {
    font-size: 0.75rem;
    color: #64748b;
    margin-top: 6px;
    min-height: 18px;
}
.btn-small {
    padding: 5px 12px;
    font-size: 0.78rem;
}

/* Mandato upload */
.ob-mandato-section {
    margin: 12px 0;
}
.ob-mandato-section > label {
    display: block;
    font-size: 0.75rem;
    font-weight: 600;
    color: #475569;
    margin-bottom: 6px;
}
.ob-mandato-dropzone {
    border: 2px dashed #94a3b8;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    cursor: pointer;
    position: relative;
    transition: border-color 0.15s;
}
.ob-mandato-dropzone:hover { border-color: var(--primary, #3b82f6); }
.ob-mandato-dropzone input[type="file"] {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}
#obMandatoLabel {
    font-size: 0.82rem;
    color: #64748b;
}
.onboarding-invitation-header { text-align: center; margin-bottom: 16px; }
.onboarding-invitation-header h2 { margin: 0 0 8px; font-size: 1.3rem; color: #1f2937; }
.onboarding-invitation-header p { margin: 0; color: #6b7280; font-size: 0.95rem; }

/* Invitation list (shared between onboarding & modal) */
.invitation-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}
.invitation-card {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
    padding: 16px 18px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #fff;
    transition: box-shadow 0.15s;
}
.invitation-card:hover {
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}
.invitation-card-icon {
    font-size: 28px;
    flex-shrink: 0;
}
.invitation-card-info {
    flex: 1;
    min-width: 220px;
}
.invitation-card-workspace {
    font-weight: 600;
    font-size: 1rem;
    color: #1f2937;
    overflow-wrap: anywhere;
}
.invitation-card-type {
    font-size: 0.85rem;
    color: #6b7280;
}
.invitation-card-by {
    font-size: 0.8rem;
    color: #9ca3af;
    margin-top: 2px;
}
.invitation-card-actions {
    display: flex;
    gap: 8px;
    flex-shrink: 0;
}
.invitation-card-actions .btn-sm {
    padding: 6px 14px;
    font-size: 0.85rem;
    border-radius: 6px;
    cursor: pointer;
    border: none;
    font-weight: 500;
}
.invitation-card-actions .btn-primary.btn-sm {
    background: #2563eb;
    color: #fff;
}
.invitation-card-actions .btn-primary.btn-sm:hover {
    background: #1d4ed8;
}
.invitation-card-actions .btn-secondary.btn-sm {
    background: #f3f4f6;
    color: #374151;
    border: 1px solid #d1d5db;
}
.invitation-card-actions .btn-secondary.btn-sm:hover {
    background: #e5e7eb;
}

/* Invitations modal (for existing/onboarded users) */
.invitations-modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    animation: fadeIn 0.2s;
}
.invitations-modal {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    width: 92%;
    max-width: 680px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: 0 8px 30px rgba(0,0,0,0.18);
}
.invitations-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.invitations-modal-header h2 {
    margin: 0;
    font-size: 1.2rem;
    color: #1f2937;
}
.invitations-modal-close {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #9ca3af;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    border-radius: 6px;
}
.invitations-modal-close:hover {
    background: #f3f4f6;
    color: #374151;
}
.invitations-modal-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
@media (max-width: 480px) {
    .onboarding-options { grid-template-columns: 1fr; }
    .onboarding-container { padding: 20px; }
    .ob-form-grid { grid-template-columns: 1fr; }
    .ob-form-grid-3col { grid-template-columns: 1fr; }
    .ob-form-grid-addr { grid-template-columns: 1fr; }
    .ob-field-numero { width: 100%; }
    .ob-field-numero input { width: 100% !important; }
    .form-group-short { max-width: none; }
    .ob-otp-channels { grid-template-columns: 1fr; }
    .ob-otp-cell { width: 34px; height: 40px; font-size: 1rem; }
    .invitation-card { flex-direction: column; text-align: center; }
    .invitation-card-actions { justify-content: center; }
    .invitations-modal { width: 95%; padding: 16px; }
}
.btn-notif-mobile {
    position: relative;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #fff;
}
.notification-badge {
    position: absolute;
    top: -2px;
    right: -4px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 4px;
}
.notifications-overlay {
    position: fixed;
    inset: 0;
    z-index: 998;
}
.notifications-panel {
    position: fixed;
    top: 60px;
    right: 20px;
    width: 360px;
    max-height: 480px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0,0,0,.15);
    z-index: 999;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.notifications-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #e5e7eb;
}
.notifications-panel-header h3 {
    margin: 0;
    font-size: 16px;
}
.notifications-panel-close {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #6b7280;
}
.notifications-list {
    overflow-y: auto;
    flex: 1;
    padding: 8px;
}
.notif-item {
    display: flex;
    gap: 12px;
    padding: 12px;
    border-radius: 8px;
    cursor: pointer;
    transition: background .15s;
}
.notif-item:hover { background: #f3f4f6; }
.notif-item-unread { background: #eff6ff; }
.notif-item-icon { font-size: 20px; flex-shrink: 0; }
.notif-item-content { flex: 1; min-width: 0; }
.notif-item-title { font-weight: 600; font-size: 13px; color: #1a1a2e; }
.notif-item-text { font-size: 12px; color: #6b7280; margin-top: 2px; }
.notif-item-time { font-size: 11px; color: #9ca3af; margin-top: 4px; }
@media (max-width: 768px) {
    .notifications-panel { right: 8px; left: 8px; width: auto; top: 56px; }
}


/* ventana del código por email para aceptar una invitación: por encima de la de invitaciones */
.modal.inv-otp { z-index: 10000; }
