*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bm-primary: #0f766e;
    --bm-primary-hover: #0d6b63;
    --bm-primary-light: #0fb89b;
    --bm-primary-bg: #f0fdfa;
    --bm-bg: #F8FAFC;
    --bm-surface: #FFFFFF;
    --bm-text: #0F172A;
    --bm-text-secondary: #475569;
    --bm-text-muted: #94A3B8;
    --bm-border: #E2E8F0;
    --bm-border-input: #CBD5E1;
    --bm-error: #DC2626;
    --bm-error-hover: #B91C1C;
    --bm-error-bg: #FEF2F2;
    --bm-error-border: #FECACA;
    --bm-success: #16A34A;
    --bm-success-bg: #F0FDF4;
    --bm-success-border: #BBF7D0;
    --bm-warning: #D97706;
    --bm-warning-bg: #FFFBEB;
    --bm-warning-border: #FDE68A;
    --bm-radius: 8px;
    --bm-radius-lg: 12px;
    --bm-font: 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --bm-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    --bm-shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
    --bm-shadow: 0 1px 3px rgba(15, 23, 42, 0.04), 0 1px 2px rgba(15, 23, 42, 0.06);
    --bm-shadow-md: 0 4px 6px -1px rgba(15, 23, 42, 0.05), 0 2px 4px -2px rgba(15, 23, 42, 0.05);
}

body {
    font-family: var(--bm-font);
    background: var(--bm-bg);
    color: var(--bm-text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ─── Page Shell ─── */

.id-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
}

.id-container {
    width: 100%;
    max-width: 420px;
}

.id-logo {
    display: flex;
    justify-content: center;
    margin-bottom: 2rem;
}

.id-logo img {
    height: 46px;
    width: auto;
}

/* ─── Card ─── */

.id-card {
    background: var(--bm-surface);
    border: 1px solid var(--bm-border);
    border-radius: var(--bm-radius-lg);
    padding: 2rem;
    box-shadow: var(--bm-shadow);
    animation: id-fade-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.id-card h1 {
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.025em;
    line-height: 1.3;
    margin-bottom: 0.25rem;
}

.id-card .id-subtitle {
    font-size: 0.875rem;
    color: var(--bm-text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.id-card .id-subtitle a {
    color: var(--bm-primary);
    text-decoration: none;
    font-weight: 500;
}

.id-card .id-subtitle a:hover {
    color: var(--bm-primary-hover);
    text-decoration: underline;
}

/* ─── Step indicator (multi-step verification flows) ─── */

.id-card .id-step {
    display: inline-block;
    font-size: 0.6875rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--bm-primary);
    background: color-mix(in srgb, var(--bm-primary) 12%, transparent);
    border-radius: 999px;
    padding: 0.25rem 0.625rem;
    margin-bottom: 0.75rem;
}

/* ─── Form Fields ─── */

.id-field {
    margin-bottom: 1.25rem;
}

.id-field label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--bm-text);
    margin-bottom: 0.375rem;
}

.id-field input[type="email"],
.id-field input[type="text"],
.id-field input[type="password"],
.id-field input[type="tel"] {
    display: block;
    width: 100%;
    padding: 0.5625rem 0.75rem;
    font-family: var(--bm-font);
    font-size: 0.875rem;
    color: var(--bm-text);
    background: var(--bm-surface);
    border: 1px solid var(--bm-border-input);
    border-radius: var(--bm-radius);
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.id-field input:focus {
    border-color: var(--bm-primary);
    box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.1);
}

.id-field input::placeholder {
    color: var(--bm-text-muted);
}

.id-field input:disabled,
.id-field input[readonly] {
    background: var(--bm-bg);
    color: var(--bm-text-secondary);
    cursor: not-allowed;
}

.id-field .field-validation-error,
.id-field .text-danger {
    display: block;
    font-size: 0.8125rem;
    color: var(--bm-error);
    margin-top: 0.25rem;
}

/* ─── Checkbox ─── */

.id-checkbox {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.id-checkbox input[type="checkbox"] {
    width: 1rem;
    height: 1rem;
    accent-color: var(--bm-primary);
    border-radius: 4px;
    cursor: pointer;
}

.id-checkbox label {
    font-size: 0.8125rem;
    color: var(--bm-text);
    cursor: pointer;
    margin: 0;
}

/* ─── Row (inline elements) ─── */

.id-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
}

/* ─── Workspace list (tenant-access requirements page) ─── */

.id-card .id-section-heading {
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    margin: 1.75rem 0 0.5rem;
}

.id-workspace-list {
    list-style: none;
    margin: 0 0 1rem;
    padding: 0;
}

.id-workspace-list li {
    font-size: 0.8125rem;
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--bm-border);
}

.id-workspace-list li:last-child {
    border-bottom: none;
}

.id-workspace-list .id-muted {
    color: var(--bm-text-secondary);
}

/* ─── Links ─── */

.id-link {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--bm-primary);
    text-decoration: none;
    transition: color 0.15s ease;
}

.id-link:hover {
    color: var(--bm-primary-hover);
    text-decoration: underline;
}

/* ─── Buttons ─── */

.id-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.625rem 1rem;
    font-family: var(--bm-font);
    font-size: 0.875rem;
    font-weight: 600;
    color: #FFFFFF;
    background: var(--bm-primary);
    border: none;
    border-radius: var(--bm-radius);
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    letter-spacing: -0.01em;
}

.id-btn:hover {
    background: var(--bm-primary-hover);
}

.id-btn:focus-visible {
    outline: 2px solid var(--bm-primary);
    outline-offset: 2px;
}

.id-btn:active {
    transform: translateY(1px);
}

.id-btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.625rem 1rem;
    font-family: var(--bm-font);
    font-size: 0.875rem;
    font-weight: 600;
    color: #FFFFFF;
    background: var(--bm-error);
    border: none;
    border-radius: var(--bm-radius);
    cursor: pointer;
    transition: background-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
    letter-spacing: -0.01em;
}

.id-btn-danger:hover {
    background: var(--bm-error-hover);
}

.id-btn-danger:focus-visible {
    outline: 2px solid var(--bm-error);
    outline-offset: 2px;
}

.id-btn-danger:active {
    transform: translateY(1px);
}

.id-btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 0.625rem 1rem;
    font-family: var(--bm-font);
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--bm-text);
    background: var(--bm-surface);
    border: 1px solid var(--bm-border-input);
    border-radius: var(--bm-radius);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
    letter-spacing: -0.01em;
}

.id-btn-secondary:hover {
    background: var(--bm-bg);
    border-color: var(--bm-text-muted);
}

.id-btn-secondary:focus-visible {
    outline: 2px solid var(--bm-primary);
    outline-offset: 2px;
}

.id-btn-secondary:active {
    transform: translateY(1px);
}

/* ─── Alerts ─── */

.validation-summary-errors ul {
    list-style: none;
    padding: 0;
}

.validation-summary-errors,
.id-alert-error {
    background: var(--bm-error-bg);
    border: 1px solid var(--bm-error-border);
    border-left: 3px solid var(--bm-error);
    border-radius: var(--bm-radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.8125rem;
    color: var(--bm-error);
    line-height: 1.5;
}

.id-alert-error p {
    margin-top: 0.375rem;
    color: var(--bm-error);
}

.id-alert-error a {
    color: var(--bm-error);
    font-weight: 500;
    text-decoration: underline;
}

.id-alert-success {
    background: var(--bm-success-bg);
    border: 1px solid var(--bm-success-border);
    border-left: 3px solid var(--bm-success);
    border-radius: var(--bm-radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.8125rem;
    color: var(--bm-success);
    line-height: 1.5;
}

.id-alert-warning {
    background: var(--bm-warning-bg);
    border: 1px solid var(--bm-warning-border);
    border-left: 3px solid var(--bm-warning);
    border-radius: var(--bm-radius);
    padding: 0.75rem 1rem;
    margin-bottom: 1.25rem;
    font-size: 0.8125rem;
    color: var(--bm-warning);
    line-height: 1.5;
}

/* ─── Message Pages (confirm email, etc.) ─── */

.id-message {
    text-align: center;
}

.id-message p {
    font-size: 0.875rem;
    color: var(--bm-text-secondary);
    line-height: 1.6;
    margin-top: 0.75rem;
}

.id-message .id-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    margin-bottom: 1rem;
}

.id-message .id-icon-success {
    background: var(--bm-success-bg);
    color: var(--bm-success);
}

.id-message .id-icon-info {
    background: var(--bm-primary-bg);
    color: var(--bm-primary);
}

.id-message .id-icon svg {
    width: 24px;
    height: 24px;
}

/* ─── Page Header (icon + title for security pages) ─── */

.id-page-header {
    display: flex;
    align-items: flex-start;
    gap: 0.875rem;
    margin-bottom: 0.25rem;
}

.id-page-header-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 10px;
    background: var(--bm-primary-bg);
    color: var(--bm-primary);
}

.id-page-header-icon svg {
    width: 20px;
    height: 20px;
}

.id-page-header-icon--danger {
    background: var(--bm-error-bg);
    color: var(--bm-error);
}

.id-page-header h1 {
    margin-bottom: 0;
}

/* ─── Manage Top Bar (back + logout) ─── */

.id-manage-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.25rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--bm-border);
}

.id-manage-topbar-link {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    font-family: var(--bm-font);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--bm-text-secondary);
    text-decoration: none;
    background: none;
    border: none;
    padding: 0.375rem 0.5rem;
    margin: -0.375rem -0.5rem;
    border-radius: var(--bm-radius);
    cursor: pointer;
    transition: color 0.15s ease, background-color 0.15s ease;
}

.id-manage-topbar-link svg {
    width: 16px;
    height: 16px;
}

.id-manage-topbar-link:hover {
    color: var(--bm-text);
    background: var(--bm-bg);
    text-decoration: none;
}

.id-manage-topbar-logout {
    color: var(--bm-text-muted);
}

.id-manage-topbar-logout:hover {
    color: var(--bm-error);
    background: var(--bm-error-bg);
}

/* ─── Manage Heading ─── */

.id-manage-heading {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--bm-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 1rem;
}

/* ─── Manage Navigation ─── */

.id-manage-nav {
    display: flex;
    gap: 0;
    margin-bottom: 1.5rem;
    border-bottom: 1px solid var(--bm-border);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.id-manage-nav::-webkit-scrollbar {
    display: none;
}

.id-manage-nav a {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--bm-text-muted);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    white-space: nowrap;
    transition: color 0.15s ease, border-color 0.2s ease;
}

.id-manage-nav a svg {
    width: 15px;
    height: 15px;
    opacity: 0.6;
    transition: opacity 0.15s ease;
}

.id-manage-nav a:hover {
    color: var(--bm-text);
    text-decoration: none;
}

.id-manage-nav a:hover svg {
    opacity: 0.85;
}

.id-manage-nav a.active {
    color: var(--bm-primary);
    border-bottom-color: var(--bm-primary);
}

.id-manage-nav a.active svg {
    opacity: 1;
}

/* ─── Recovery Codes ─── */

.id-recovery-codes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.375rem;
    padding: 1rem;
    background: var(--bm-bg);
    border: 1px solid var(--bm-border);
    border-radius: var(--bm-radius);
    font-family: var(--bm-mono);
    font-size: 0.8125rem;
    letter-spacing: 0.04em;
    margin: 1rem 0;
}

.id-recovery-codes span {
    padding: 0.375rem 0.5rem;
    background: var(--bm-surface);
    border: 1px solid var(--bm-border);
    border-radius: 4px;
    text-align: center;
    color: var(--bm-text);
}

/* ─── QR Code ─── */

.id-qr-code {
    display: flex;
    justify-content: center;
    margin: 1.25rem 0;
}

.id-qr-code img {
    border: 1px solid var(--bm-border);
    border-radius: var(--bm-radius-lg);
    padding: 1rem;
    background: white;
    box-shadow: var(--bm-shadow-sm);
}

/* ─── Setup Key ─── */

.id-setup-key {
    font-family: var(--bm-mono);
    font-size: 0.8125rem;
    letter-spacing: 0.06em;
    word-break: break-all;
    background: var(--bm-bg);
    padding: 0.75rem 1rem;
    border: 1px solid var(--bm-border);
    border-radius: var(--bm-radius);
    margin: 0.75rem 0;
    color: var(--bm-text-secondary);
    user-select: all;
}

/* ─── Status Badge ─── */

.id-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.125rem 0.5rem;
    border-radius: 9999px;
    margin-top: 0.375rem;
}

.id-badge-success {
    color: var(--bm-success);
    background: var(--bm-success-bg);
}

.id-badge-error {
    color: var(--bm-error);
    background: var(--bm-error-bg);
}

/* ─── Button Group ─── */

.id-btn-group {
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    margin-top: 1.25rem;
}

.id-btn-group a {
    text-align: center;
    text-decoration: none;
}

/* ─── Spacing Utilities ─── */

.id-mt-1 { margin-top: 1rem; }
.id-mb-1 { margin-bottom: 1rem; }
.id-mb-125 { margin-bottom: 1.25rem; }
.id-text-center { text-align: center; }

/* ─── Footer ─── */

.id-footer {
    text-align: center;
    padding: 1.5rem 1rem;
    font-size: 0.75rem;
    color: var(--bm-text-muted);
}

.id-footer a {
    color: var(--bm-text-secondary);
    text-decoration: none;
}

.id-footer a:hover {
    text-decoration: underline;
}

/* ─── Animation ─── */

@keyframes id-fade-in {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ─── Passkey ─── */

.id-passkey-divider {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin: 1.5rem 0;
    color: var(--bm-text-muted);
    font-size: 0.8125rem;
}

.id-passkey-divider::before,
.id-passkey-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--bm-border);
}

.id-passkey-list {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 1.25rem;
}

.id-passkey-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--bm-border);
}

.id-passkey-item:first-child {
    border-top: 1px solid var(--bm-border);
}

.id-passkey-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.id-passkey-info strong {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
}

.id-passkey-meta {
    font-size: 0.75rem;
    color: var(--bm-text-muted);
    margin-top: 0.125rem;
}

.id-passkey-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.id-link-danger {
    font-family: var(--bm-font);
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--bm-error);
    text-decoration: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s ease;
}

.id-link-danger:hover {
    color: var(--bm-error-hover);
    text-decoration: underline;
}

/* Override Bootstrap text-danger for this layout */
.text-danger { color: var(--bm-error) !important; font-size: 0.8125rem; }

/* ─── Login Two-Column Layout ─── */

.id-login-page {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 1rem;
    min-height: 100vh;
    background: linear-gradient(160deg, #f7f7f9 0%, #f0fdfa 100%);
    position: relative;
    overflow: hidden;
}

.id-login-page::before {
    content: '';
    position: absolute;
    top: -160px;
    right: -160px;
    width: 520px;
    height: 520px;
    border-radius: 50%;
    background: rgba(15, 118, 110, 0.08);
    pointer-events: none;
}

.id-login-page::after {
    content: '';
    position: absolute;
    bottom: -140px;
    left: -140px;
    width: 480px;
    height: 480px;
    border-radius: 50%;
    background: rgba(15, 184, 155, 0.06);
    pointer-events: none;
}

.id-login-split {
    display: grid;
    grid-template-columns: 1fr 440px;
    gap: 4rem;
    max-width: 1040px;
    width: 100%;
    padding: 0 3.75rem;
    align-items: center;
    position: relative;
    z-index: 1;
}

.id-login-brand {
    display: flex;
    flex-direction: column;
}

.id-login-brand-logo {
    display: flex;
    align-items: center;
    margin-bottom: 2.25rem;
}

.id-login-brand-logo-img {
    height: 52px;
    width: auto;
    display: block;
}

.id-login-brand h1 {
    font-size: 2.5rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.1;
    margin-bottom: 1rem;
    color: var(--bm-text);
}

.id-login-brand p {
    font-size: 0.9375rem;
    line-height: 1.6;
    color: var(--bm-text-secondary);
    max-width: 420px;
}

.id-login-card {
    background: var(--bm-surface);
    border-radius: 16px;
    padding: 2.25rem;
    box-shadow: 0 24px 48px rgba(15, 118, 110, 0.12), 0 0 0 1px rgba(16, 17, 28, 0.05);
    animation: id-fade-in 0.3s cubic-bezier(0.22, 1, 0.36, 1);
}

.id-login-card h2 {
    font-size: 1.375rem;
    font-weight: 600;
    letter-spacing: -0.015em;
    margin-bottom: 0.375rem;
}

.id-login-card .id-subtitle {
    font-size: 0.8125rem;
    color: var(--bm-text-secondary);
    margin-bottom: 1.5rem;
    line-height: 1.6;
}

.id-login-card .id-subtitle a {
    color: var(--bm-primary);
    text-decoration: none;
    font-weight: 500;
}

.id-login-card .id-subtitle a:hover {
    color: var(--bm-primary-hover);
    text-decoration: underline;
}

.id-login-card .id-btn {
    height: 42px;
    box-shadow: 0 1px 2px rgba(15, 118, 110, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.id-login-card .id-passkey-divider span {
    font-family: var(--bm-mono);
    text-transform: uppercase;
    font-size: 0.6875rem;
    letter-spacing: 0.08em;
}

@media (max-width: 768px) {
    .id-login-split {
        grid-template-columns: 1fr;
        gap: 2rem;
        max-width: 420px;
        padding: 0 1rem;
    }

    .id-login-brand {
        text-align: center;
    }

    .id-login-brand-logo {
        justify-content: center;
    }

    .id-login-brand h1 {
        font-size: 1.75rem;
    }

    .id-login-brand p {
        display: none;
    }
}

@media (max-width: 480px) {
    .id-login-page {
        padding: 1rem;
    }

    .id-login-card {
        padding: 1.5rem;
    }
}
