/*
 * Shared styles for the sign-in pages: merchant (/merchant/login) and personal (/login).
 * Design tokens come from merchant-modern.css (--mm-*), with fallbacks.
 */

:root {
    --ml-bg: #ffffff;
    --ml-subtle: var(--mm-bg, #f4f6fb);
    --ml-text: var(--mm-text, #0f172a);
    --ml-text-2: var(--mm-text-2, #334155);
    --ml-muted: var(--mm-muted, #64748b);
    --ml-faint: var(--mm-subtle, #94a3b8);
    --ml-border: var(--mm-border, #e6eaf2);
    --ml-border-strong: var(--mm-border-strong, #d7dde8);
    --ml-primary: var(--mm-primary, #2563eb);
    --ml-primary-600: var(--mm-primary-600, #1d4ed8);
    --ml-primary-50: var(--mm-primary-50, #eff6ff);
    --ml-navy: var(--mm-navy, #0b1f3f);
    --ml-navy-2: var(--mm-navy-2, #16325c);
    --ml-gold: #f6b60b;
    --ml-danger: var(--mm-danger, #dc2626);
    --ml-danger-50: #fef2f2;
    --ml-success: var(--mm-success, #15803d);
    --ml-success-50: #f0fdf4;
    --ml-warning: #b45309;
    --ml-radius: 14px;
    --ml-radius-sm: 10px;
    --ml-font: var(--mm-font, 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif);
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background: var(--ml-bg);
    color: var(--ml-text);
    font-family: var(--ml-font);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-text-size-adjust: 100%;
}

a { color: var(--ml-primary); text-decoration: none; }
a:hover { color: var(--ml-primary-600); }

.ml-shell {
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr);
}

/* ================= Form side ================= */
.ml-main {
    display: flex;
    flex-direction: column;
    padding: 32px 48px;
}

.ml-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.ml-logo img { height: 40px; width: auto; display: block; margin-left: -6px; }

.ml-top__link { font-size: 14px; color: var(--ml-muted); }
.ml-top__link:hover { color: var(--ml-text); }

.ml-form-wrap {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 0;
}

.ml-form-inner { width: 100%; max-width: 400px; }

.ml-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 4px 10px 4px 6px;
    border-radius: 999px;
    background: var(--ml-primary-50);
    color: var(--ml-primary-600);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .02em;
    margin-bottom: 18px;
}

.ml-eyebrow span {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--ml-primary);
    display: grid;
    place-items: center;
}

.ml-eyebrow svg { width: 11px; height: 11px; color: #fff; }

h1.ml-title {
    margin: 0 0 8px;
    font-size: 30px;
    line-height: 1.15;
    font-weight: 700;
    letter-spacing: -0.025em;
}

.ml-sub { margin: 0 0 28px; color: var(--ml-muted); font-size: 15px; }

.ml-field { margin-bottom: 18px; }

.ml-field label {
    display: block;
    font-size: 13.5px;
    font-weight: 600;
    color: var(--ml-text-2);
    margin-bottom: 7px;
}

.ml-control { position: relative; }

.ml-control__icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    width: 18px;
    height: 18px;
    color: var(--ml-faint);
    pointer-events: none;
    transition: color 150ms ease;
}

.ml-input {
    width: 100%;
    height: 50px;
    padding: 0 14px 0 44px;
    font: inherit;
    font-size: 16px;
    color: var(--ml-text);
    background: #fff;
    border: 1px solid var(--ml-border-strong);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
    transition: border-color 150ms ease, box-shadow 150ms ease;
}

.ml-input::placeholder { color: var(--ml-faint); }

.ml-input:hover { border-color: #c3cad8; }

.ml-input:focus {
    outline: none;
    border-color: var(--ml-primary);
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .12);
}

.ml-control:focus-within .ml-control__icon { color: var(--ml-primary); }

.ml-input--pw { padding-right: 52px; }

.ml-eye {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--ml-muted);
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background-color 150ms ease, color 150ms ease;
}

.ml-eye svg { width: 19px; height: 19px; }
.ml-eye .ml-eye__off { display: none; }
.ml-eye[aria-pressed="true"] .ml-eye__on { display: none; }
.ml-eye[aria-pressed="true"] .ml-eye__off { display: block; }

@media (hover: hover) and (pointer: fine) {
    .ml-eye:hover { background: var(--ml-subtle); color: var(--ml-text); }
}

.ml-eye:focus-visible { outline: 2px solid var(--ml-primary); outline-offset: 1px; }

.ml-caps {
    display: none;
    align-items: center;
    gap: 6px;
    margin-top: 7px;
    font-size: 13px;
    color: var(--ml-warning);
}

.ml-caps.is-on { display: flex; }
.ml-caps svg { width: 14px; height: 14px; }

.ml-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 2px 0 20px;
    font-size: 14px;
}

.ml-check {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    color: var(--ml-text-2);
    cursor: pointer;
    user-select: none;
}

.ml-check input {
    appearance: none;
    -webkit-appearance: none;
    margin: 0;
    width: 18px;
    height: 18px;
    border: 1.5px solid var(--ml-border-strong);
    border-radius: 5px;
    background: #fff;
    display: grid;
    place-items: center;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.ml-check input::after {
    content: "";
    width: 9px;
    height: 5px;
    border-left: 2px solid #fff;
    border-bottom: 2px solid #fff;
    transform: rotate(-45deg) translate(1px, -1px) scale(0.6);
    opacity: 0;
    transition: transform 160ms var(--ease-out), opacity 120ms ease;
}

.ml-check input:checked { background: var(--ml-primary); border-color: var(--ml-primary); }
.ml-check input:checked::after { opacity: 1; transform: rotate(-45deg) translate(1px, -1px) scale(1); }
.ml-check input:focus-visible { outline: 2px solid var(--ml-primary); outline-offset: 2px; }

.ml-link { font-weight: 600; }

.ml-captcha {
    margin: 0 0 20px;
    min-height: 78px;
}

.ml-alert {
    display: none;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 14px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.ml-alert::before {
    content: "";
    flex: 0 0 8px;
    height: 8px;
    margin-top: 7px;
    border-radius: 50%;
    background: currentColor;
}

.ml-alert.is-error { display: flex; background: var(--ml-danger-50); border-color: #fecaca; color: #991b1b; }
.ml-alert.is-info { display: flex; background: var(--ml-primary-50); border-color: #bfdbfe; color: #1e3a8a; }
.ml-alert.is-success { display: flex; background: var(--ml-success-50); border-color: #bbf7d0; color: #14532d; }
.ml-alert a { color: inherit; font-weight: 600; text-decoration: underline; }

.ml-alert.is-error, .ml-alert.is-info, .ml-alert.is-success {
    animation: ml-pop 220ms var(--ease-out);
}

@keyframes ml-pop {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.ml-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    height: 52px;
    border-radius: 12px;
    font: inherit;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid transparent;
    text-decoration: none;
    transition: transform 160ms var(--ease-out), background-color 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}

.ml-btn:active:not(:disabled) { transform: scale(0.97); }
.ml-btn:focus-visible { outline: 2px solid var(--ml-primary); outline-offset: 3px; }

.ml-btn--primary {
    color: #fff;
    background: linear-gradient(180deg, #3b74f0 0%, var(--ml-primary) 100%);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .12), 0 6px 16px -6px rgba(37, 99, 235, .55), inset 0 1px 0 rgba(255, 255, 255, .18);
}

@media (hover: hover) and (pointer: fine) {
    .ml-btn--primary:hover { background: linear-gradient(180deg, #2f68e6 0%, var(--ml-primary-600) 100%); }
    .ml-btn--ghost:hover { background: var(--ml-subtle); border-color: #c3cad8; color: var(--ml-text); }
}

.ml-btn--primary:disabled { cursor: progress; opacity: .85; }

.ml-btn--ghost {
    background: #fff;
    color: var(--ml-text);
    border-color: var(--ml-border-strong);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}

.ml-btn__arrow { width: 18px; height: 18px; transition: transform 200ms var(--ease-out); }

@media (hover: hover) and (pointer: fine) {
    .ml-btn--primary:hover .ml-btn__arrow { transform: translateX(2px); }
}

.ml-spinner {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: ml-spin .7s linear infinite;
    display: none;
}

.is-busy .ml-spinner { display: inline-block; }
.is-busy .ml-btn__arrow { display: none; }
@keyframes ml-spin { to { transform: rotate(360deg); } }

.ml-divider {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 24px 0;
    color: var(--ml-faint);
    font-size: 13px;
}

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

.ml-trust {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
    font-size: 13px;
    color: var(--ml-muted);
}

.ml-trust svg { width: 15px; height: 15px; color: var(--ml-success); }

.ml-foot {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--ml-faint);
}

.ml-foot a { color: var(--ml-faint); }
.ml-foot a:hover { color: var(--ml-text-2); }

/* Entrance: a single, quick settle on first load (seen once per visit). */
.ml-enter > * {
    animation: ml-rise 420ms var(--ease-out) both;
}

.ml-enter > *:nth-child(2) { animation-delay: 40ms; }
.ml-enter > *:nth-child(3) { animation-delay: 80ms; }
.ml-enter > *:nth-child(4) { animation-delay: 120ms; }
.ml-enter > *:nth-child(5) { animation-delay: 160ms; }
.ml-enter > *:nth-child(n+6) { animation-delay: 200ms; }

@keyframes ml-rise {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ================= Brand side ================= */
.ml-aside {
    position: relative;
    overflow: hidden;
    color: #e2e8f0;
    background:
        radial-gradient(60% 50% at 85% 10%, rgba(59, 130, 246, .45) 0%, rgba(59, 130, 246, 0) 70%),
        radial-gradient(50% 45% at 10% 90%, rgba(246, 182, 11, .22) 0%, rgba(246, 182, 11, 0) 70%),
        radial-gradient(40% 35% at 60% 60%, rgba(99, 102, 241, .25) 0%, rgba(99, 102, 241, 0) 70%),
        linear-gradient(160deg, #0a1a36 0%, var(--ml-navy) 45%, #0c2550 100%);
}

.ml-aside::before {
    /* fine grid */
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, .05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .05) 1px, transparent 1px);
    background-size: 44px 44px;
    -webkit-mask-image: radial-gradient(80% 70% at 50% 40%, #000 30%, transparent 85%);
    mask-image: radial-gradient(80% 70% at 50% 40%, #000 30%, transparent 85%);
    pointer-events: none;
}

.ml-aside__inner {
    position: relative;
    height: 100%;
    max-height: 100vh;
    max-height: 100dvh;
    overflow-y: auto;
    padding: 56px 64px;
    display: flex;
    flex-direction: column;
    gap: 36px;
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, .2) transparent;
}

.ml-hero h2 {
    margin: 0 0 12px;
    font-size: 34px;
    line-height: 1.12;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #fff;
    max-width: 16ch;
}

.ml-hero h2 em {
    font-style: normal;
    background: linear-gradient(90deg, #93c5fd, #fcd34d);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.ml-hero p { margin: 0; color: #b6c2d6; font-size: 16px; max-width: 44ch; }

/* Floating "dashboard" preview (decorative) */
.ml-preview {
    position: relative;
    max-width: 440px;
    padding: 20px;
    border-radius: 18px;
    background: linear-gradient(180deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .05));
    border: 1px solid rgba(255, 255, 255, .14);
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .55), inset 0 1px 0 rgba(255, 255, 255, .12);
    -webkit-backdrop-filter: blur(14px);
    backdrop-filter: blur(14px);
}

.ml-preview__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }

.ml-preview__label { font-size: 12px; color: #9fb0c9; letter-spacing: .02em; }

.ml-preview__amount {
    font-size: 28px;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: #fff;
    font-variant-numeric: tabular-nums;
}

.ml-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(34, 197, 94, .16);
    color: #86efac;
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.ml-preview svg.ml-spark { display: block; width: 100%; height: 64px; margin: 10px 0 14px; }

.ml-tx { display: grid; gap: 10px; }

.ml-tx__item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .06);
    font-size: 13.5px;
}

.ml-tx__dot {
    flex: 0 0 30px;
    height: 30px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 12px;
    font-weight: 700;
    color: #0b1f3f;
}

.ml-tx__name { color: #e2e8f0; font-weight: 600; }
.ml-tx__meta { color: #9fb0c9; font-size: 12px; }
.ml-tx__amt { margin-left: auto; color: #86efac; font-weight: 600; font-variant-numeric: tabular-nums; }

.ml-float-badge {
    position: absolute;
    right: -14px;
    top: -16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 12px;
    background: #fff;
    color: var(--ml-text);
    font-size: 12.5px;
    font-weight: 600;
    box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .45);
}

.ml-float-badge i {
    width: 22px;
    height: 22px;
    border-radius: 7px;
    background: var(--ml-gold);
    display: grid;
    place-items: center;
}

.ml-float-badge svg { width: 13px; height: 13px; color: #0b1f3f; }

/* What's next steps */
.ml-steps-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ml-steps-head h3 { margin: 0; font-size: 17px; font-weight: 650; color: #fff; }
.ml-steps-head span { font-size: 13px; color: #9fb0c9; }

.ml-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: step;
    display: grid;
    gap: 8px;
    max-width: 520px;
}

.ml-steps details {
    border-radius: 12px;
    background: rgba(255, 255, 255, .05);
    border: 1px solid rgba(255, 255, 255, .09);
    transition: background-color 150ms ease, border-color 150ms ease;
}

.ml-steps details[open] { background: rgba(255, 255, 255, .08); border-color: rgba(255, 255, 255, .16); }

@media (hover: hover) and (pointer: fine) {
    .ml-steps details:hover { background: rgba(255, 255, 255, .08); }
}

.ml-steps summary {
    list-style: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    font-size: 14.5px;
    font-weight: 600;
    color: #f1f5f9;
    border-radius: 12px;
}

.ml-steps summary::-webkit-details-marker { display: none; }

.ml-steps summary::before {
    counter-increment: step;
    content: counter(step);
    flex: 0 0 26px;
    height: 26px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .1);
    border: 1px solid rgba(255, 255, 255, .14);
    display: grid;
    place-items: center;
    font-size: 12.5px;
    font-weight: 700;
    color: #fff;
}

.ml-steps details[open] summary::before { background: var(--ml-gold); border-color: var(--ml-gold); color: #0b1f3f; }

.ml-steps summary::after {
    content: "";
    margin-left: auto;
    width: 7px;
    height: 7px;
    border-right: 2px solid #8ea0bb;
    border-bottom: 2px solid #8ea0bb;
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform 200ms var(--ease-out);
}

.ml-steps details[open] summary::after { transform: rotate(-135deg) translate(-2px, -2px); }

.ml-steps summary:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }

.ml-step__body { padding: 0 16px 14px 52px; color: #b6c2d6; font-size: 14px; }
.ml-step__body ul { margin: 6px 0 0; padding-left: 16px; }
.ml-step__body li { margin: 3px 0; }
.ml-step__body li::marker { color: #6b7f9e; }

@media (prefers-reduced-motion: reduce) {
    .ml-enter > *, .ml-alert { animation: none !important; }
    .ml-btn, .ml-btn__arrow, .ml-steps summary::after, .ml-check input::after { transition: none; }
    .ml-spinner { animation-duration: 1.6s; }
}

/* ================= Responsive ================= */
@media (max-width: 1100px) {
    .ml-aside__inner { padding: 48px 40px; }
    .ml-float-badge { right: 8px; }
}

@media (max-width: 960px) {
    .ml-shell { grid-template-columns: minmax(0, 1fr); }
    .ml-main { padding: 20px 20px 28px; min-height: 100vh; min-height: 100dvh; }
    .ml-form-wrap { padding: 28px 0 32px; align-items: flex-start; }
    .ml-aside__inner { max-height: none; overflow: visible; padding: 44px 20px 48px; }
    .ml-preview { display: none; }
    .ml-hero h2 { font-size: 26px; }
}

@media (max-width: 480px) {
    h1.ml-title { font-size: 26px; }
    .ml-logo img { height: 34px; }
    .ml-top__link { display: none; }
    .ml-foot { flex-direction: column; align-items: center; text-align: center; }
}

/* ================= Personal sign-in extras (/login) ================= */
.ml-actions {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin: 16px 0 14px;
}

.ml-action {
    display: grid;
    justify-items: center;
    gap: 6px;
    padding: 10px 4px;
    border-radius: 12px;
    background: rgba(255, 255, 255, .06);
    font-size: 12px;
    color: #c9d4e5;
}

.ml-action i {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    font-style: normal;
}

.ml-action svg { width: 16px; height: 16px; color: #0b1f3f; }

.ml-benefits {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 14px;
    max-width: 520px;
}

.ml-benefits li {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.ml-benefits i {
    flex: 0 0 36px;
    height: 36px;
    border-radius: 11px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .12);
}

.ml-benefits svg { width: 18px; height: 18px; color: #fcd34d; }
.ml-benefits strong { display: block; color: #fff; font-size: 15px; font-weight: 600; }
.ml-benefits span { color: #b6c2d6; font-size: 14px; }

.ml-switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 16px;
    padding: 12px 14px;
    border: 1px dashed var(--ml-border-strong);
    border-radius: 12px;
    font-size: 14px;
    color: var(--ml-text-2);
}

.ml-switch a { font-weight: 600; white-space: nowrap; }
