/* ── CRM Auth Pages ──────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    height: 100%;
}

.crm-page-body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 14px;
    color: #111827;
    background: #f1f5f9;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ── Background pattern ───────────────────────────────────────────────────── */
.crm-page-body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 50% at 20% 20%, rgba(37,99,235,.08) 0%, transparent 60%),
        radial-gradient(ellipse 60% 60% at 80% 80%, rgba(16,185,129,.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
}

/* ── Wrapper ─────────────────────────────────────────────────────────────── */
.crm-auth-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    animation: crm-fadeup .35s ease both;
}

.crm-register-wide {
    max-width: 860px;
}

@keyframes crm-fadeup {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Card ────────────────────────────────────────────────────────────────── */
.crm-auth-card {
    background: #fff;
    border-radius: 16px;
    box-shadow:
        0 0 0 1px rgba(15,23,42,.06),
        0 4px 6px -1px rgba(15,23,42,.05),
        0 20px 40px -8px rgba(15,23,42,.10);
    padding: 36px 32px 32px;
}

/* ── Logo ────────────────────────────────────────────────────────────────── */
.crm-auth-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 24px;
}

.crm-auth-logo svg {
    flex-shrink: 0;
    border-radius: 8px;
}

.crm-auth-logo span {
    font-size: 17px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -.3px;
}

/* ── Headings ────────────────────────────────────────────────────────────── */
.crm-auth-title {
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 6px;
    letter-spacing: -.4px;
    line-height: 1.2;
}

.crm-auth-subtitle {
    font-size: 14px;
    color: #64748b;
    margin: 0 0 24px;
    line-height: 1.5;
}

/* ── Fields ──────────────────────────────────────────────────────────────── */
.crm-auth-field {
    margin-bottom: 16px;
}

.crm-auth-field label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.crm-auth-field input {
    display: block;
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    font-family: inherit;
    color: #0f172a;
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    outline: none;
    -webkit-appearance: none;
}

.crm-auth-field input:focus {
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.crm-auth-field input:invalid:not(:placeholder-shown) {
    border-color: #ef4444;
}

.crm-auth-field input[readonly] {
    background: #f8fafc;
    color: #64748b;
    cursor: not-allowed;
}

/* ── Password input wrapper ──────────────────────────────────────────────── */
.crm-auth-input-wrap {
    position: relative;
}

.crm-auth-input-wrap input {
    padding-right: 44px;
}

.crm-auth-toggle-pw {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: #9ca3af;
    display: flex;
    align-items: center;
    transition: color .15s;
}

.crm-auth-toggle-pw:hover { color: #374151; }

/* ── Button ──────────────────────────────────────────────────────────────── */
.crm-auth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 11px 16px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: background .15s, box-shadow .15s, transform .1s;
    margin-top: 8px;
    letter-spacing: -.1px;
}

.crm-auth-btn:hover {
    background: #1d4ed8;
    box-shadow: 0 4px 12px rgba(37,99,235,.3);
}

.crm-auth-btn:active {
    transform: translateY(1px);
}

.crm-auth-btn:disabled {
    background: #93c5fd;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* ── Spinner ─────────────────────────────────────────────────────────────── */
@keyframes crm-spin {
    to { transform: rotate(360deg); }
}

.crm-spin {
    animation: crm-spin .7s linear infinite;
}

/* ── Notices ─────────────────────────────────────────────────────────────── */
.crm-auth-notice {
    padding: 11px 14px;
    border-radius: 8px;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 20px;
}

.crm-auth-notice-error {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.crm-auth-notice-success {
    background: #f0fdf4;
    color: #166534;
    border: 1px solid #bbf7d0;
}

.crm-auth-notice-info {
    background: #eff6ff;
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

/* ── Links ───────────────────────────────────────────────────────────────── */
.crm-auth-link,
.crm-auth-link-inline {
    color: #2563eb;
    text-decoration: none;
    font-weight: 500;
    font-size: 13px;
}

.crm-auth-link:hover,
.crm-auth-link-inline:hover {
    text-decoration: underline;
}

.crm-auth-footer-link {
    font-size: 13px;
    color: #64748b;
    margin: 20px 0 0;
    text-align: center;
}

.crm-auth-note {
    font-size: 12px;
    color: #94a3b8;
    margin: 10px 0 0;
    line-height: 1.5;
}

/* ── Register page (wide, two-column) ────────────────────────────────────── */
.crm-register-card-outer {
    padding: 36px 36px 32px;
}

.crm-register-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-top: 4px;
}

.crm-register-col {
    border: 1.5px solid #e2e8f0;
    border-radius: 12px;
    padding: 22px 22px 20px;
    background: #fafbfc;
}

.crm-register-col-header {
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid #e2e8f0;
}

.crm-register-col-header strong {
    display: block;
    font-size: 15px;
    font-weight: 700;
    color: #0f172a;
    margin-bottom: 2px;
}

.crm-register-col-header span {
    font-size: 13px;
    color: #64748b;
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
    .crm-register-cols {
        grid-template-columns: 1fr;
    }
    .crm-auth-card,
    .crm-register-card-outer {
        padding: 28px 20px 24px;
    }
}

@media (max-width: 480px) {
    .crm-page-body {
        align-items: flex-start;
        padding-top: 32px;
    }
}
