/* ════════════════════════════════════════════════════════════════
   KOMUNAH · LOGIN
   ════════════════════════════════════════════════════════════════ */
:root {
    --bg: #ffffff;
    --bg-soft: #f6f7f8;
    --ink: #0b0d12;
    --ink-hover: #232833;
    --body: #3f4551;
    --muted: #8a919e;
    --faint: #c4c9d4;
    --line: #e6e8ec;
    --line-strong: #d3d7de;
    --error: #d92d20;
    --success: #067647;
    --warn: #b54708;
    --warn-bg: #fffaeb;
    --warn-line: #fedf89;
    --ease: cubic-bezier(.22, 1, .36, 1);
    --font-ui: 'Inter', system-ui, -apple-system, sans-serif;
    --font-serif: Georgia, 'Times New Roman', serif;
}

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

html,
body {
    height: 100%;
    width: 100%;
}

body {
    font-family: var(--font-ui);
    background: var(--bg);
    color: var(--ink);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

::selection {
    background: var(--ink);
    color: #fff;
}

button {
    font-family: inherit;
}

a {
    color: inherit;
}

:focus-visible {
    outline: 2px solid var(--ink);
    outline-offset: 3px;
    border-radius: 3px;
}

/* ── Shell ── */
.shell {
    display: flex;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
}

/* ══════════ PANEL IZQUIERDO ══════════ */
.panel {
    width: 100%;
    max-width: 520px;
    height: 100%;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 2.25rem 4rem 1.75rem;
    overflow-y: auto;
    position: relative;
    background: radial-gradient(120% 60% at 0% 0%, rgba(11, 13, 18, .025), transparent 55%), var(--bg);
}

@media (max-width: 767px) {
    .panel {
        max-width: 100%;
        padding: 1.75rem 1.5rem 1.5rem;
    }
}

/* Marca */
.panel__top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 2.5rem;
}

.brand {
    display: flex;
    align-items: center;
    gap: 11px;
    text-decoration: none;
}

.brand__mark {
    height: 40px;
    max-width: 180px;
    object-fit: contain;
    object-position: left;
    transition: transform .4s var(--ease), filter .4s var(--ease);
    filter: drop-shadow(0 2px 6px rgba(214, 162, 78, 0.20));
}

.brand:hover .brand__mark {
    transform: scale(1.06);
    filter: drop-shadow(0 0 16px rgba(214, 162, 78, 0.75)) brightness(1.12);
}

.brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1;
}

.brand__name {
    font-size: 17px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.brand__sub {
    font-size: 8.5px;
    font-weight: 600;
    letter-spacing: .28em;
    color: var(--muted);
    margin-top: 4px;
    text-transform: uppercase;
}

.env-tag {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    color: var(--muted);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: 5px 10px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-soft);
}

.env-tag i {
    font-size: 11px;
    color: var(--success);
}

/* Encabezado */
.panel__main {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
}

.eyebrow {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 14px;
}

.pulse-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--success);
    position: relative;
    flex-shrink: 0;
}

.pulse-dot::after {
    content: "";
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 1.5px solid var(--success);
    opacity: 0;
    animation: ping 2.2s var(--ease) infinite;
}

@keyframes ping {
    0% {
        transform: scale(.4);
        opacity: .8;
    }

    70% {
        transform: scale(1.15);
        opacity: 0;
    }

    100% {
        opacity: 0;
    }
}

.title {
    font-size: clamp(26px, 2.8vw, 32px);
    font-weight: 800;
    letter-spacing: -.035em;
    line-height: 1.12;
    margin-bottom: 10px;
}

.mask {
    display: block;
    overflow: hidden;
    padding-bottom: .08em;
    margin-bottom: -.08em;
}

.mask__inner {
    display: block;
    transform: translateY(112%);
    animation: rise .9s var(--ease) forwards;
}

.mask:nth-child(2) .mask__inner {
    animation-delay: .12s;
}

@keyframes rise {
    to {
        transform: translateY(0);
    }
}

.title .accent {
    color: var(--muted);
}

.subtitle {
    font-size: 13.5px;
    line-height: 1.6;
    color: var(--muted);
    margin-bottom: 2rem;
}

/* Aparición escalonada */
.reveal {
    opacity: 0;
    transform: translateY(14px);
    animation: fadeUp .7s var(--ease) forwards;
    animation-delay: var(--d, 0s);
}

@keyframes fadeUp {
    to {
        opacity: 1;
        transform: none;
    }
}

/* ── Campos ── */
.field {
    margin-bottom: 1.15rem;
    position: relative;
}

.field__labelrow {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 8px;
}

.field__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--body);
    letter-spacing: .01em;
    transition: color .2s;
}

.field__control {
    position: relative;
    border-bottom: 1px solid var(--line-strong);
}

.field__input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    padding: 11px 0 10px;
    font-size: 15px;
    font-family: inherit;
    color: var(--ink);
    transition: opacity .2s;
    -webkit-appearance: none;
    appearance: none;
    box-shadow: none !important;
}

.field__input::placeholder {
    color: var(--faint);
    font-weight: 400;
}

.field__input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 60px #fff inset;
    -webkit-text-fill-color: var(--ink);
}

.field__line {
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 2px;
    background: var(--ink);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .45s var(--ease), background .2s;
}

.field__control:focus-within .field__line {
    transform: scaleX(1);
}

.field__input:focus+.field__line {
    transform: scaleX(1);
}

/* Toggle contraseña */
.field__input--pw {
    padding-right: 42px;
}

.pw-toggle {
    position: absolute;
    right: -4px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: var(--muted);
    font-size: 17px;
    padding: 6px;
    border-radius: 6px;
    display: flex;
    align-items: center;
    transition: color .15s, transform .15s;
}

.pw-toggle:hover {
    color: var(--ink);
}

.pw-toggle:active {
    transform: translateY(-50%) scale(.9);
}

/* Aviso Bloq Mayús */
.caps-hint {
    display: none;
    align-items: center;
    gap: 5px;
    font-size: 10.5px;
    font-weight: 600;
    color: var(--warn);
    background: var(--warn-bg);
    border: 1px solid var(--warn-line);
    padding: 2px 8px;
    border-radius: 999px;
}

.caps-hint.on {
    display: inline-flex;
    animation: fadeUp .3s var(--ease);
}

.caps-hint i {
    font-size: 12px;
}

/* Mensajes de error */
.field__msg {
    min-height: 19px;
    margin-top: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--error);
    display: flex;
    align-items: center;
    gap: 6px;
    opacity: 0;
    transform: translateY(-3px);
    transition: opacity .25s, transform .25s;
}

.field__msg i {
    font-size: 13px;
}

.field--error .field__msg {
    opacity: 1;
    transform: none;
}

.field--error .field__label {
    color: var(--error);
}

.field--error .field__control {
    border-bottom-color: transparent;
}

.field--error .field__line {
    background: var(--error);
    transform: scaleX(1);
}

/* ── Opciones ── */
.options {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 2px 0 24px;
}

.check {
    display: flex;
    align-items: center;
    gap: 9px;
    cursor: pointer;
    user-select: none;
    font-size: 13px;
    color: var(--muted);
}

.check input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.check__box {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--line-strong);
    border-radius: 5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background .2s, border-color .2s;
    background: #fff;
}

.check__box svg {
    width: 9px;
    height: 7px;
    stroke: #fff;
    stroke-width: 2;
    fill: none;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 14;
    stroke-dashoffset: 14;
    transition: stroke-dashoffset .3s var(--ease) .05s;
}

.check input:checked+.check__box {
    background: var(--ink);
    border-color: var(--ink);
}

.check input:checked+.check__box svg {
    stroke-dashoffset: 0;
}

.check input:focus-visible+.check__box {
    outline: 2px solid var(--ink);
    outline-offset: 2px;
}

.check:hover .check__box {
    border-color: var(--muted);
}

.forgot {
    font-size: 13px;
    font-weight: 500;
    color: var(--body);
    text-decoration: none;
    position: relative;
}

.forgot::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -2px;
    height: 1px;
    width: 100%;
    background: var(--ink);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform .35s var(--ease);
}

.forgot:hover::after {
    transform: scaleX(1);
}

.forgot:hover {
    color: var(--ink);
}

/* ── Botones ── */
.btn-primary {
    width: 100%;
    height: 48px;
    border: none;
    border-radius: 10px;
    cursor: pointer;
    background: var(--ink);
    color: #fff;
    font-size: 13.5px;
    font-weight: 600;
    letter-spacing: .01em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: background .2s, transform .2s var(--ease), box-shadow .2s;
    box-shadow: 0 1px 2px rgba(11, 13, 18, .15);
}

.btn-primary:hover:not(:disabled) {
    background: var(--ink-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(11, 13, 18, .22);
}

.btn-primary:active:not(:disabled) {
    transform: translateY(0) scale(.985);
}

.btn-primary:disabled {
    cursor: default;
    opacity: .92;
}

.btn-primary .btn-arrow {
    transition: transform .3s var(--ease);
}

.btn-primary:hover .btn-arrow {
    transform: translateX(3px);
}

.btn-primary.is-success {
    background: var(--success);
}

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

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

.divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 22px 0 14px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.btn-google {
    width: 100%;
    height: 46px;
    border-radius: 10px;
    cursor: pointer;
    text-decoration: none;
    background: #fff;
    color: var(--body);
    font-size: 13.5px;
    font-weight: 500;
    border: 1.5px solid var(--line);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: border-color .2s, background .2s, transform .2s var(--ease), box-shadow .2s;
}

.btn-google:hover {
    background: var(--bg-soft);
    border-color: var(--line-strong);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(11, 13, 18, .08);
}

.btn-google:active {
    transform: translateY(0);
}

.secure-note {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    font-size: 11px;
    color: var(--muted);
}

.secure-note i {
    font-size: 12px;
}

.help-row {
    margin-top: 26px;
    text-align: center;
    font-size: 12.5px;
    color: var(--muted);
}

.help-row a {
    font-weight: 600;
    color: var(--ink);
    text-decoration: none;
    border-bottom: 1px solid var(--line-strong);
    transition: border-color .2s;
}

.help-row a:hover {
    border-color: var(--ink);
}

/* Shake en submit inválido */
.shake {
    animation: shake .45s var(--ease);
}

@keyframes shake {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-7px);
    }

    40% {
        transform: translateX(6px);
    }

    60% {
        transform: translateX(-4px);
    }

    80% {
        transform: translateX(3px);
    }
}

/* ── Pie del panel ── */
.panel__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    padding-top: 2rem;
    font-size: 11px;
    color: var(--muted);
}

.foot-nav {
    display: flex;
    gap: 16px;
}

.foot-nav a {
    text-decoration: none;
    color: var(--muted);
    transition: color .15s;
}

.foot-nav a:hover {
    color: var(--ink);
}

/* ══════════ PANEL DERECHO · HERO ══════════ */
.hero {
    display: none;
    position: relative;
    flex: 1;
    height: 100%;
    overflow: hidden;
    background: #0d1a20;
}

@media (min-width: 768px) {
    .hero {
        display: block;
    }
}

.hero__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transform-origin: 50% 50%;
    will-change: transform;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    animation: breathe 28s cubic-bezier(0.4, 0, 0.2, 1) infinite alternate;
}

@keyframes breathe {
    from {
        transform: scale3d(1, 1, 1) translateZ(0);
    }
    to {
        transform: scale3d(1.05, 1.05, 1) translateZ(0);
    }
}

.hero__shade {
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(to top, rgba(6, 12, 16, .82) 0%, rgba(6, 12, 16, 0) 46%), linear-gradient(to bottom, rgba(6, 12, 16, .38) 0%, rgba(6, 12, 16, 0) 26%);
}

.hero__grain {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .08;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.55'/%3E%3C/svg%3E");
}

.hero__top {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 26px;
    z-index: 10;
}

.chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    padding: 7px 13px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .9);
    background: rgba(8, 14, 18, .35);
    border: 1px solid rgba(255, 255, 255, .18);
    backdrop-filter: blur(8px);
}

.chip i {
    font-size: 12px;
}

.hero__quote {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    padding: 44px 34px 30px;
    color: #fff;
    z-index: 10;
}

.hero__quote blockquote {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: clamp(16px, 1.35vw, 19.5px);
    line-height: 1.55;
    max-width: 54ch;
    letter-spacing: .005em;
}

.hero__quote figcaption {
    margin-top: 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: .2em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, .68);
}

.hero__quote figcaption::before {
    content: "";
    width: 28px;
    height: 1px;
    background: rgba(255, 255, 255, .55);
}

/* ── Toasts ── */
.toast-region {
    position: fixed;
    right: 20px;
    bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    z-index: 80;
}

.toast {
    min-width: 280px;
    max-width: 350px;
    display: flex;
    gap: 11px;
    align-items: flex-start;
    background: #101318;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 12px;
    padding: 13px 14px;
    box-shadow: 0 14px 38px rgba(6, 10, 16, .3);
    opacity: 0;
    transform: translateY(14px);
    transition: opacity .4s var(--ease), transform .4s var(--ease);
}

.toast--in {
    opacity: 1;
    transform: none;
}

.toast--out {
    opacity: 0;
    transform: translateY(8px) scale(.97);
}

.toast__icon {
    font-size: 17px;
    margin-top: 1px;
    flex-shrink: 0;
}

.toast--success .toast__icon {
    color: #4cd49a;
}

.toast--error .toast__icon {
    color: #ff8078;
}

.toast--info .toast__icon {
    color: #8fb7ff;
}

.toast__body {
    flex: 1;
}

.toast__title {
    font-size: 12.5px;
    font-weight: 700;
    margin-bottom: 2px;
}

.toast__msg {
    font-size: 12px;
    line-height: 1.5;
    color: rgba(255, 255, 255, .72);
}

.toast__close {
    background: none;
    border: none;
    color: rgba(255, 255, 255, .5);
    cursor: pointer;
    font-size: 15px;
    padding: 2px;
    border-radius: 4px;
}

.toast__close:hover {
    color: #fff;
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }

    .mask__inner {
        transform: none;
        animation: none;
    }

    .reveal {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .hero__img {
        animation: none;
    }
}