:root {
    --bg-deep: #060c18;
    --bg-mid: #0b1730;
    --panel: rgba(15, 27, 51, 0.55);
    --panel-border: rgba(94, 234, 212, 0.25);
    --accent: #22d3ee;
    --accent-soft: rgba(34, 211, 238, 0.35);
    --accent-strong: #5eead4;
    --text: #e7f6ff;
    --text-dim: #93a7c4;
    --danger: #ff6b6b;
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 18% 20%, rgba(34, 211, 238, 0.16), transparent 40%),
        radial-gradient(circle at 85% 15%, rgba(94, 234, 212, 0.12), transparent 45%),
        radial-gradient(circle at 50% 100%, rgba(59, 130, 246, 0.18), transparent 55%),
        linear-gradient(160deg, var(--bg-deep), var(--bg-mid) 60%, var(--bg-deep));
    background-attachment: fixed;
    overflow-x: hidden;
}

/* Faint moving grid — pure CSS, no image download, GPU-cheap (only
   background-position animates). Disabled under reduced-motion below. */
body::before {
    content: "";
    position: fixed;
    inset: -10% -10% -10% -10%;
    background-image:
        linear-gradient(rgba(94, 234, 212, 0.06) 1px, transparent 1px),
        linear-gradient(90deg, rgba(94, 234, 212, 0.06) 1px, transparent 1px);
    background-size: 42px 42px;
    mask-image: radial-gradient(circle at 50% 35%, black, transparent 70%);
    -webkit-mask-image: radial-gradient(circle at 50% 35%, black, transparent 70%);
    animation: gridDrift 40s linear infinite;
    pointer-events: none;
    z-index: 0;
}

@keyframes gridDrift {
    0% { transform: translate(0, 0); }
    100% { transform: translate(42px, 42px); }
}

.login-wrap {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
}

.login-card {
    background: var(--panel);
    border: 1px solid var(--panel-border);
    border-radius: var(--radius);
    padding: clamp(22px, 5vw, 36px);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    box-shadow:
        0 0 0 1px rgba(94, 234, 212, 0.05),
        0 25px 60px rgba(0, 0, 0, 0.45),
        0 0 40px rgba(34, 211, 238, 0.08);
}

.brand {
    text-align: center;
    margin-bottom: 6px;
}

.brand img {
    width: min(72%, 260px);
    height: auto;
    display: inline-block;
    filter: drop-shadow(0 0 18px rgba(34, 211, 238, 0.35));
}

.status-pill {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin: 14px 0 22px;
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-strong);
}

.status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-strong);
    box-shadow: 0 0 8px var(--accent-strong);
    animation: pulse 1.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.4; transform: scale(0.7); }
}

.field {
    position: relative;
    margin-bottom: 16px;
}

.field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--text-dim);
    pointer-events: none;
    transition: color 0.2s ease;
}

.field input {
    width: 100%;
    padding: 16px 44px 16px 42px;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(6, 12, 24, 0.55);
    color: var(--text);
    font-size: 16px; /* keeps iOS Safari from auto-zooming on focus */
    outline: none;
    transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.field input::placeholder {
    color: var(--text-dim);
}

.field input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
    background: rgba(6, 12, 24, 0.8);
}

.field input:focus + .field-icon,
.field:focus-within .field-icon {
    color: var(--accent);
}

.toggle-visibility {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 8px;
    display: flex;
    color: var(--text-dim);
    cursor: pointer;
    border-radius: 8px;
}

.toggle-visibility:hover,
.toggle-visibility:focus-visible {
    color: var(--accent);
}

.toggle-visibility svg {
    width: 18px;
    height: 18px;
}

.remember-row {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 4px 2px 22px;
    user-select: none;
}

.remember-row input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 5px;
    border: 1px solid rgba(148, 163, 184, 0.4);
    background: rgba(6, 12, 24, 0.55);
    display: grid;
    place-content: center;
    cursor: pointer;
    flex-shrink: 0;
}

.remember-row input[type="checkbox"]::before {
    content: "";
    width: 10px;
    height: 10px;
    transform: scale(0);
    transition: transform 0.12s ease;
    box-shadow: inset 1em 1em var(--accent);
    clip-path: polygon(14% 44%, 0 65%, 50% 100%, 100% 16%, 80% 0%, 43% 62%);
}

.remember-row input[type="checkbox"]:checked::before {
    transform: scale(1);
}

.remember-row label {
    font-size: 13.5px;
    color: var(--text-dim);
    cursor: pointer;
}

.btn-signin {
    width: 100%;
    padding: 15px;
    border: none;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: 0.03em;
    color: #04141a;
    background: linear-gradient(120deg, var(--accent-strong), var(--accent));
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    box-shadow: 0 10px 30px rgba(34, 211, 238, 0.25);
    transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.btn-signin svg {
    width: 17px;
    height: 17px;
}

.btn-signin:hover,
.btn-signin:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 14px 34px rgba(34, 211, 238, 0.35);
    filter: brightness(1.05);
}

.btn-signin:active {
    transform: translateY(0);
}

.login-footer {
    text-align: center;
    margin-top: 22px;
    font-size: 11.5px;
    line-height: 1.6;
    color: var(--text-dim);
}

@media (max-width: 380px) {
    .login-card {
        padding: 20px 18px;
    }
}

@media (prefers-reduced-motion: reduce) {
    body::before {
        animation: none;
    }
    .status-dot {
        animation: none;
    }
}