/* Untuna CRM – Login */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
    --navy:        #1a2744;
    --navy-light:  #243456;
    --accent:      #3b82f6;
    --accent-dark: #2563eb;
    --bg:          #f3f4f6;
    --card:        #ffffff;
    --text:        #1f2937;
    --text-muted:  #6b7280;
    --border:      #e5e7eb;
    --radius:      14px;
    --shadow:      0 4px 24px rgba(0, 0, 0, .08);
    --safe-top: env(safe-area-inset-top, 0px);
    --safe-right: env(safe-area-inset-right, 0px);
    --safe-bottom: env(safe-area-inset-bottom, 0px);
    --safe-left: env(safe-area-inset-left, 0px);
    --sys-nav-fallback: 0px;
    --inset-bottom: max(var(--safe-bottom), var(--sys-nav-fallback));
}

html.crm-android-pwa {
    --sys-nav-fallback: 48px;
}

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

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    width: 100%;
    overflow-x: hidden;
    min-height: 100vh;
    min-height: 100dvh;
    padding: var(--safe-top) var(--safe-right) var(--inset-bottom) var(--safe-left);
}

/* ── Layout ── */
.login-wrapper {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: calc(100dvh - var(--safe-top) - var(--inset-bottom));
}

/* ── Left branding panel (desktop) ── */
.login-brand {
    display: none;
    flex: 0 0 44%;
    background: var(--navy);
    color: #fff;
    flex-direction: column;
    justify-content: center;
    padding: 3rem 3.5rem;
    position: relative;
    overflow: hidden;
}

.login-brand::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -120px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: rgba(59, 130, 246, .12);
}

.login-brand::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 280px;
    height: 280px;
    border-radius: 50%;
    background: rgba(59, 130, 246, .08);
}

.brand-content {
    position: relative;
    z-index: 1;
}

.brand-logo {
    display: flex;
    align-items: center;
    gap: .75rem;
    margin-bottom: 2.5rem;
}

.brand-logo img {
    width: 48px;
    height: 48px;
    object-fit: contain;
    border-radius: 10px;
}

.brand-logo .logo-icon {
    width: 48px;
    height: 48px;
    background: var(--accent);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.4rem;
}

.brand-logo span {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -.02em;
}

.brand-tagline {
    font-size: 1.75rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 1rem;
    letter-spacing: -.02em;
}

.brand-desc {
    font-size: .95rem;
    color: rgba(255, 255, 255, .65);
    line-height: 1.6;
    max-width: 340px;
    margin-bottom: 2.5rem;
}

.brand-features {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: .85rem;
}

.brand-features li {
    display: flex;
    align-items: center;
    gap: .75rem;
    font-size: .9rem;
    color: rgba(255, 255, 255, .8);
}

.brand-features li i {
    width: 32px;
    height: 32px;
    background: rgba(59, 130, 246, .2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #93c5fd;
    font-size: .95rem;
    flex-shrink: 0;
}

/* ── Right form panel ── */
.login-form-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
}

/* Mobile header */
.mobile-header {
    display: flex;
    align-items: center;
    gap: .65rem;
    margin-bottom: 1.75rem;
    width: 100%;
    max-width: 420px;
}

.mobile-header .logo-icon {
    width: 40px;
    height: 40px;
    background: var(--navy);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 1.15rem;
}

.mobile-header span {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--navy);
}

/* ── Card ── */
.login-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 2rem 2rem 1.75rem;
    width: 100%;
    max-width: 420px;
    border: 1px solid var(--border);
}

.login-card h2 {
    font-size: 1.35rem;
    font-weight: 700;
    margin: 0 0 .35rem;
    color: var(--text);
    letter-spacing: -.02em;
}

.login-card .subtitle {
    font-size: .875rem;
    color: var(--text-muted);
    margin-bottom: 1.75rem;
}

/* ── Alert ── */
.alert-login {
    display: flex;
    align-items: flex-start;
    gap: .6rem;
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 10px;
    padding: .75rem 1rem;
    font-size: .85rem;
    margin-bottom: 1.25rem;
    line-height: 1.4;
}

.alert-login i {
    flex-shrink: 0;
    margin-top: 1px;
}

/* ── Form fields ── */
.form-group {
    margin-bottom: 1.15rem;
}

.form-group label {
    display: block;
    font-size: .82rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: .4rem;
}

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

.input-wrap > i.field-icon {
    position: absolute;
    left: .85rem;
    color: var(--text-muted);
    font-size: .95rem;
    pointer-events: none;
    z-index: 1;
}

.input-wrap input {
    width: 100%;
    padding: .7rem .85rem .7rem 2.5rem;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: .9rem;
    font-family: inherit;
    color: var(--text);
    background: #fafafa;
    transition: border-color .2s, box-shadow .2s, background .2s;
    outline: none;
}

.input-wrap input:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .15);
}

.input-wrap input::placeholder {
    color: #9ca3af;
}

.toggle-password {
    position: absolute;
    right: .75rem;
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: .25rem;
    font-size: 1rem;
    line-height: 1;
    z-index: 1;
    transition: color .2s;
}

.toggle-password:hover {
    color: var(--accent);
}

/* ── Submit button ── */
.btn-login {
    width: 100%;
    padding: .75rem;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: .95rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .5rem;
    transition: background .2s, transform .1s, box-shadow .2s;
    margin-top: .5rem;
}

.btn-login:hover {
    background: var(--accent-dark);
    box-shadow: 0 4px 14px rgba(37, 99, 235, .35);
}

.btn-login:active {
    transform: scale(.985);
}

.btn-login:disabled {
    opacity: .65;
    cursor: not-allowed;
}

.btn-login .spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

.btn-install-login {
    width: 100%;
    min-height: 44px;
    margin-top: .75rem;
    border: 1px solid #a7f3d0;
    border-radius: 10px;
    color: #047857;
    background: #ecfdf5;
    font: inherit;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-install-login:hover {
    color: #fff;
    background: #059669;
    border-color: #059669;
}

.btn-install-login:disabled {
    opacity: .65;
    cursor: not-allowed;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ── Footer ── */
.login-footer {
    text-align: center;
    margin-top: 1.5rem;
    font-size: .78rem;
    color: var(--text-muted);
}

/* ── Desktop breakpoint ── */
@media (min-width: 992px) {
    .login-brand {
        display: flex;
    }

    .mobile-header {
        display: none;
    }

    .login-form-panel {
        padding: 2rem 3rem;
    }

    .login-card {
        padding: 2.5rem 2.5rem 2rem;
    }
}

/* ── Small phones ── */
@media (max-width: 380px) {
    .login-form-panel {
        padding: 1rem;
    }

    .login-card {
        padding: 1.5rem 1.25rem 1.25rem;
        border-radius: 12px;
        box-shadow: none;
        border: none;
    }

    .login-card h2 {
        font-size: 1.2rem;
    }
}

@media (max-width: 767px) {
    .input-wrap input {
        min-height: 46px;
        font-size: 16px;
    }

    .toggle-password {
        width: 44px;
        height: 44px;
        right: .2rem;
    }

    .btn-login {
        min-height: 46px;
    }
}
