/* =========================================================
   LOGIN SCREEN
========================================================= */

#loginScreen {
    position: fixed;
    inset: 0;
    z-index: 900;
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    overflow: hidden;
    background: linear-gradient(140deg, #0071db 0%, #3d8ce0 45%, #79b1f1 100%);
}

body.is-authed #loginScreen {
    display: none;
}

body.is-authed .app {
    display: block;
}

.app {
    display: none;
}

/* ---------- overlay ---------- */

.login-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
}

/* Emblem shapes are drawn through CSS masks so they can be tinted white on orange. */

.login-pattern {
    position: absolute;
    inset: 0;
    background: #fff;
    opacity: .13;
    -webkit-mask-image: url("../../assets/palmmind-mark-tile.svg"), linear-gradient(115deg, #000 0%, transparent 62%);
    -webkit-mask-size: 132px 132px, 100% 100%;
    -webkit-mask-repeat: repeat, no-repeat;
    -webkit-mask-composite: source-in;
    mask-image: url("../../assets/palmmind-mark-tile.svg"), linear-gradient(115deg, #000 0%, transparent 62%);
    mask-size: 132px 132px, 100% 100%;
    mask-repeat: repeat, no-repeat;
    mask-composite: intersect;
}

.login-emblem {
    position: absolute;
    width: min(62vw, 820px);
    aspect-ratio: 1;
    left: -18%;
    bottom: -34%;
    background: #fff;
    opacity: .17;
    -webkit-mask: var(--emblem-mask-image) center / contain no-repeat;
    mask: var(--emblem-mask-image) center / contain no-repeat;
}

/* Keep the emblem upright everywhere: it depicts a deity, so never rotate or flip it. */
.login-emblem--corner {
    width: 300px;
    left: auto;
    bottom: auto;
    right: -70px;
    top: -110px;
    opacity: .17;
}

/* ---------- brand panel ---------- */

.login-brand-panel {
    position: relative;
    z-index: 1;
    color: #fff;
    padding: 52px 56px;
    display: flex;
    flex-direction: column;
}

.login-brand-top {
    display: flex;
    align-items: center;
    gap: 12px;
}

.login-brand-logo {
    padding: 9px 16px;
    border-radius: 14px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 8px 24px rgba(10, 60, 120, .25);
    display: flex;
    align-items: center;
}

.login-brand-logo img {
    height: 34px;
    display: block;
}

.login-brand-top {
    gap: 18px;
}

.login-product {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-left: 18px;
    border-left: 1px solid rgba(255, 255, 255, .45);
}

.login-product-name {
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.01em;
    line-height: 1.2;
}

.login-product-tag {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    opacity: .85;
}

.login-hero {
    margin-top: auto;
    max-width: 500px;
}

.login-hero-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .18);
    border: 1px solid rgba(255, 255, 255, .35);
    backdrop-filter: blur(10px);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .03em;
    margin-bottom: 22px;
}

.login-hero-pill .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(255, 255, 255, .3);
}

.login-hero h1 {
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 36px;
    line-height: 1.15;
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: 14px;
    text-shadow: 0 2px 18px rgba(0, 70, 140, .18);
}

.login-hero p {
    font-size: 14px;
    line-height: 1.7;
    opacity: .92;
    margin-bottom: 28px;
}

.login-float-cards {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.login-float-card {
    display: flex;
    align-items: center;
    gap: 12px;
    width: fit-content;
    padding: 12px 18px 12px 12px;
    border-radius: 16px;
    background: rgba(255, 255, 255, .2);
    border: 1px solid rgba(255, 255, 255, .4);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    box-shadow: 0 10px 30px rgba(0, 70, 140, .15);
}

.login-float-card--offset {
    margin-left: 56px;
}

.login-float-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: #fff;
    color: var(--primary);
    display: grid;
    place-items: center;
}

.login-float-icon svg {
    width: 17px;
    height: 17px;
}

.login-float-title {
    font-size: 13px;
    font-weight: 800;
}

.login-float-sub {
    font-size: 11px;
    opacity: .85;
}

.login-hero-stats {
    display: flex;
    gap: 32px;
    padding-top: 24px;
    border-top: 1px solid rgba(255, 255, 255, .3);
}

.login-hero-stat-value {
    font-size: 22px;
    font-weight: 800;
    font-family: "Plus Jakarta Sans", sans-serif;
}

.login-hero-stat-label {
    font-size: 11px;
    opacity: .85;
    margin-top: 2px;
}

/* ---------- form panel (glass card) ---------- */

.login-form-panel {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.login-form-card {
    width: 100%;
    max-width: 420px;
    padding: 40px 38px 30px;
    border-radius: 24px;
    background: var(--surface-glass);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(22px) saturate(1.3);
    -webkit-backdrop-filter: blur(22px) saturate(1.3);
    box-shadow:
        0 1px 2px rgba(0, 52, 104, .08),
        0 28px 56px -18px rgba(0, 62, 124, .38),
        inset 0 1px 0 rgba(255, 255, 255, .9);
}

.login-card-logo {
    height: 38px;
    display: block;
    margin-bottom: 12px;
}

.login-card-product {
    display: inline-block;
    margin-bottom: 24px;
    padding: 5px 11px;
    border-radius: 999px;
    background: var(--primary-soft-2);
    border: 1px solid var(--primary-soft);
    color: var(--primary-dark);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.login-form-title {
    font-family: "Plus Jakarta Sans", sans-serif;
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -.02em;
    margin-bottom: 6px;
}

.login-form-sub {
    color: var(--text-2);
    font-size: 13px;
    margin-bottom: 26px;
}

.login-field {
    margin-bottom: 16px;
}

.login-label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-2);
    margin-bottom: 7px;
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap svg {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: var(--text-3);
    transition: color var(--transition);
}

.login-input-wrap:focus-within svg {
    color: var(--primary);
}

.login-input {
    width: 100%;
    padding: 12px 14px 12px 40px;
    border: 1px solid rgba(202, 220, 241, .9);
    border-radius: 12px;
    font-size: 13.5px;
    background: rgba(255, 255, 255, .7);
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.login-input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(0, 113, 219, .16);
    outline: none;
}

.login-remember {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 4px 0 22px;
    font-size: 12.5px;
    color: var(--text-2);
    font-weight: 600;
    cursor: pointer;
}

.login-remember input {
    accent-color: var(--primary);
}

.login-error {
    margin: -8px 0 16px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--danger-soft);
    border: 1px solid rgba(200, 61, 61, .25);
    color: var(--danger);
    font-size: 12.5px;
    font-weight: 600;
}

.login-submit:disabled {
    opacity: .7;
    cursor: wait;
    transform: none;
}

.login-submit {
    width: 100%;
    padding: 13px;
    border-radius: 12px;
    background: var(--primary-gradient);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    box-shadow: 0 10px 24px rgba(0, 113, 219, .35);
    transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}

.login-submit:hover {
    transform: translateY(-1px);
    filter: brightness(1.04);
    box-shadow: 0 14px 30px rgba(0, 113, 219, .45);
}

.login-footer-note {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin-top: 24px;
    padding-top: 18px;
    border-top: 1px solid rgba(202, 220, 241, .6);
    color: var(--text-3);
    font-size: 11px;
}

@media (max-width: 860px) {
    #loginScreen {
        grid-template-columns: 1fr;
    }
    .login-brand-panel {
        display: none;
    }
    .login-form-panel {
        padding: 20px;
    }
    .login-form-card {
        padding: 32px 24px 24px;
    }
}

.login-form-card {
    animation: login-card-in 420ms cubic-bezier(.2, .8, .2, 1) both;
}

@keyframes login-card-in {
    from { opacity: 0; transform: translateY(12px); }
}

@media (prefers-reduced-motion: reduce) {
    .login-form-card { animation: none; }
}

/* ---------- Pali, on the brand panel ---------- */

.login-mascot {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px 0 4px;
}

.login-mascot-art {
    width: 88px;
    height: 88px;
    flex: none;
    background: var(--mascot-image) center / contain no-repeat;
    filter: drop-shadow(0 8px 18px rgba(0, 40, 80, .35));
    animation: mascot-bob 3.6s ease-in-out infinite;
}

@keyframes mascot-bob {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-5px); }
}

.login-mascot-bubble {
    position: relative;
    padding: 10px 15px;
    border-radius: 14px 14px 14px 4px;
    background: rgba(255, 255, 255, .17);
    border: 1px solid rgba(255, 255, 255, .3);
    backdrop-filter: blur(6px);
    color: #fff;
    font-size: 12.5px;
    font-weight: 600;
    line-height: 1.45;
}

@media (max-width: 1080px) {
    .login-mascot { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    .login-mascot-art { animation: none; }
}
