/* =========================================================================
   UNIESTRO CONTRACT — authentication screens (Uniestro design system)
   ========================================================================= */
:root {
    --ink: #0b1226;
    --ink-2: #28324d;
    --muted: #66718c;
    --faint: #98a2b8;
    --line: rgba(18, 32, 84, .1);
    --blue: #2b5cff;
    --blue-deep: #1c3fd1;
    --cyan: #14b8e6;
    --violet: #7c4dff;
    --grad: linear-gradient(120deg, #2b5cff 0%, #5b6bff 48%, #14b8e6 100%);
    --ease: cubic-bezier(.2, .8, .2, 1);

    --st-draft: #8591a8;
    --st-sent_to_customer: #5b5ff0;
    --st-customer_viewed: #0aa5cf;
    --st-customer_signed: #8a55f5;
    --st-approved: #2f6df0;
    --st-active: #0eab7a;
    --st-completed: #0b8f87;
}

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

html, body { margin: 0; min-height: 100%; }

body {
    font-family: "Plus Jakarta Sans", Inter, "Segoe UI", system-ui, sans-serif;
    color: var(--ink);
    background: #f4f6fd;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ------------------------------------------------------------ ambience */
.ua-ambient {
    position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none;
    background: linear-gradient(180deg, #fafbff 0%, #eff3fe 100%);
}
.ua-ambient span { position: absolute; border-radius: 50%; filter: blur(80px); will-change: transform; }
.ua-ambient span:nth-child(1) { width: 52vw; height: 52vw; left: -14vw; top: -22vw; background: radial-gradient(circle, rgba(43, 92, 255, .38), transparent 65%); animation: uaDrift 24s ease-in-out infinite alternate; }
.ua-ambient span:nth-child(2) { width: 44vw; height: 44vw; right: -12vw; top: -4vw; background: radial-gradient(circle, rgba(20, 184, 230, .32), transparent 65%); animation: uaDrift 30s ease-in-out -9s infinite alternate-reverse; }
.ua-ambient span:nth-child(3) { width: 42vw; height: 42vw; left: 24vw; bottom: -26vw; background: radial-gradient(circle, rgba(124, 77, 255, .28), transparent 65%); animation: uaDrift 28s ease-in-out -14s infinite alternate; }
.ua-ambient::after {
    content: ""; position: absolute; inset: 0;
    background-image: radial-gradient(rgba(30, 50, 130, .1) 1px, transparent 1.2px);
    background-size: 28px 28px;
    -webkit-mask-image: radial-gradient(ellipse at 30% 40%, #000, transparent 72%);
    mask-image: radial-gradient(ellipse at 30% 40%, #000, transparent 72%);
}
@keyframes uaDrift { from { transform: translate3d(0, 0, 0) scale(1); } to { transform: translate3d(5vw, 4vh, 0) scale(1.12); } }

/* --------------------------------------------------------------- shell */
.ua-shell {
    position: relative; z-index: 1;
    min-height: 100vh; min-height: 100dvh;
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr);
    grid-template-rows: auto minmax(0, 1fr);
    column-gap: clamp(24px, 5vw, 88px);
    row-gap: clamp(20px, 4vh, 44px);
    padding: clamp(20px, 3vw, 40px) clamp(24px, 5vw, 80px) clamp(24px, 4vw, 56px);
    align-items: center;
}

/* Page-level utilities (brand left, language right) live in one row of the grid,
   so the card below never has to be pushed away with margins. */
.ua-topbar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.ua-brand { display: block; line-height: 0; }
.ua-brand img { height: 26px; width: auto; display: block; }

/* ---------------------------------------------------------------- hero */
.ua-hero { display: flex; flex-direction: column; gap: 34px; max-width: 640px; animation: uaRise .8s var(--ease) both; }

.ua-eyebrow {
    display: inline-flex; align-items: center; gap: 10px;
    font-size: 11px; font-weight: 800; letter-spacing: .24em; text-transform: uppercase; color: var(--blue);
}
.ua-eyebrow::before { content: ""; width: 26px; height: 2px; border-radius: 2px; background: var(--grad); }

.ua-title { margin: 14px 0 0; font-size: clamp(42px, 6vw, 76px); font-weight: 800; letter-spacing: -.055em; line-height: .98; }
.ua-title span {
    display: inline-block;
    background: linear-gradient(110deg, #0b1226 0%, #1c3fd1 45%, #14b8e6 100%);
    background-size: 200% 100%;
    -webkit-background-clip: text; background-clip: text; color: transparent;
    animation: uaShift 9s ease-in-out infinite alternate;
}
@keyframes uaShift { to { background-position: 100% 0; } }

.ua-lead { margin: 18px 0 0; max-width: 480px; font-size: 16px; line-height: 1.65; color: var(--muted); font-weight: 500; }

/* ------------------------------------------------------ workflow stage */
.ua-stage {
    --step: 0;
    --row: 46px;
    --node: 36px;
    position: relative;
    max-width: 480px;
    padding: 20px 22px 22px;
    border-radius: 26px;
    background: linear-gradient(160deg, rgba(255, 255, 255, .86), rgba(255, 255, 255, .55));
    border: 1px solid rgba(255, 255, 255, .95);
    box-shadow: 0 0 0 1px rgba(24, 44, 120, .06), 0 1px 0 rgba(255, 255, 255, .95) inset, 0 50px 80px -44px rgba(24, 44, 120, .55);
    backdrop-filter: blur(20px) saturate(170%);
    -webkit-backdrop-filter: blur(20px) saturate(170%);
    overflow: hidden;
}
.ua-stage::before {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(115deg, transparent 38%, rgba(255, 255, 255, .7) 50%, transparent 62%);
    transform: translateX(-120%);
    animation: uaSheen 7s ease-in-out 1s infinite;
}
@keyframes uaSheen { 0%, 55% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }

.ua-stage__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.ua-stage__title { display: inline-flex; align-items: center; gap: 9px; font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-2); }
.ua-stage__title i { width: 8px; height: 8px; border-radius: 50%; background: var(--blue); box-shadow: 0 0 0 0 rgba(43, 92, 255, .5); animation: uaPulse 2.2s ease-out infinite; }
@keyframes uaPulse { 70%, 100% { box-shadow: 0 0 0 9px rgba(43, 92, 255, 0); } }

.ua-chip {
    --c: var(--st-draft);
    padding: 6px 12px; border-radius: 999px;
    font-size: 11.5px; font-weight: 700; white-space: nowrap;
    color: color-mix(in srgb, var(--c) 80%, #0b1226);
    background: color-mix(in srgb, var(--c) 12%, #fff);
    border: 1px solid color-mix(in srgb, var(--c) 28%, transparent);
    transition: color .4s, background .4s, border-color .4s;
}
.ua-chip[data-status="sent_to_customer"] { --c: var(--st-sent_to_customer); }
.ua-chip[data-status="customer_viewed"] { --c: var(--st-customer_viewed); }
.ua-chip[data-status="customer_signed"] { --c: var(--st-customer_signed); }
.ua-chip[data-status="approved"] { --c: var(--st-approved); }
.ua-chip[data-status="active"] { --c: var(--st-active); }
.ua-chip[data-status="completed"] { --c: var(--st-completed); }

.ua-rail { position: relative; display: grid; }

.ua-focus {
    position: absolute; left: -8px; right: -8px; top: 0; height: var(--row);
    border-radius: 16px;
    background: linear-gradient(90deg, rgba(43, 92, 255, .1), rgba(20, 184, 230, .07));
    box-shadow: 0 0 0 1px rgba(43, 92, 255, .14);
    transform: translateY(calc(var(--step) * var(--row)));
    transition: transform .7s var(--ease);
}

.ua-row {
    position: relative;
    display: grid; grid-template-columns: var(--node) 1fr auto; align-items: center; gap: 14px;
    height: var(--row);
    color: var(--faint);
    transition: color .4s;
}

/* connector between nodes; it fills as the mandate moves forward */
.ua-row:not(:last-child)::before,
.ua-row:not(:last-child)::after {
    content: ""; position: absolute; left: calc(var(--node) / 2 - 1px); top: calc(50% + var(--node) / 2 + 1px); width: 2px; height: calc(var(--row) - var(--node) - 2px);
    border-radius: 2px;
}
.ua-row:not(:last-child)::before { background: rgba(18, 32, 84, .1); }
.ua-row:not(:last-child)::after {
    background: linear-gradient(180deg, var(--blue), var(--cyan));
    transform: scaleY(0); transform-origin: top;
    transition: transform .6s var(--ease);
}
.ua-row.is-done:not(:last-child)::after { transform: scaleY(1); }

.ua-node {
    position: relative; z-index: 1;
    width: var(--node); height: var(--node); display: grid; place-items: center;
    border-radius: 12px;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 0 0 1px rgba(18, 32, 84, .1);
    color: var(--faint);
    transition: transform .5s var(--ease), background .5s, color .4s, box-shadow .5s;
}
.ua-label { font-size: 14px; font-weight: 600; letter-spacing: -.01em; }
.ua-index { font-size: 11px; font-weight: 700; letter-spacing: .1em; color: rgba(18, 32, 84, .25); font-variant-numeric: tabular-nums; }

.ua-row.is-done { color: var(--ink-2); }
.ua-row.is-done .ua-node { background: var(--grad); color: #fff; box-shadow: 0 8px 18px -8px rgba(43, 92, 255, .7); }

.ua-row.is-active { color: var(--ink); }
.ua-row.is-active .ua-label { font-weight: 800; }
.ua-row.is-active .ua-node {
    background: var(--grad); color: #fff; transform: scale(1.1);
    box-shadow: 0 0 0 5px rgba(43, 92, 255, .14), 0 12px 24px -8px rgba(43, 92, 255, .8);
    animation: uaNode 1.9s ease-in-out infinite;
}
@keyframes uaNode { 50% { box-shadow: 0 0 0 9px rgba(43, 92, 255, 0), 0 12px 24px -8px rgba(43, 92, 255, .8); } }

/* energy pulse travelling down the freshly lit connector */
.ua-row.is-active:not(:last-child)::after { transform: scaleY(1); transition-duration: 1.4s; }

.ua-stage.is-complete .ua-row:last-child .ua-node { background: linear-gradient(120deg, #0eab7a, #14b8a6); box-shadow: 0 0 0 5px rgba(14, 171, 122, .16), 0 12px 24px -8px rgba(14, 171, 122, .8); animation: none; }
.ua-stage.is-complete .ua-focus { background: linear-gradient(90deg, rgba(14, 171, 122, .12), rgba(20, 184, 230, .06)); box-shadow: 0 0 0 1px rgba(14, 171, 122, .22); }

.ua-progress { margin-top: 16px; height: 4px; border-radius: 4px; background: rgba(18, 32, 84, .08); overflow: hidden; }
.ua-progress span { display: block; height: 100%; border-radius: inherit; background: var(--grad); transform-origin: left; transform: scaleX(calc(var(--step) / 6)); transition: transform .7s var(--ease); }

/* ----------------------------------------------------------- auth card */
.ua-panel { display: flex; justify-content: center; animation: uaRise .8s var(--ease) .1s both; }

.ua-card {
    position: relative;
    width: 100%; max-width: 460px;
    padding: 40px clamp(24px, 4vw, 44px) 36px;
    border-radius: 30px;
    background: linear-gradient(160deg, rgba(255, 255, 255, .9), rgba(255, 255, 255, .66));
    border: 1px solid rgba(255, 255, 255, .95);
    box-shadow: 0 0 0 1px rgba(24, 44, 120, .07), 0 1px 0 rgba(255, 255, 255, .95) inset, 0 60px 90px -44px rgba(24, 44, 120, .55), 0 10px 28px -16px rgba(24, 44, 120, .2);
    backdrop-filter: blur(24px) saturate(170%);
    -webkit-backdrop-filter: blur(24px) saturate(170%);
    overflow: hidden;
}
/* gradient hairline across the top */
.ua-card::before { content: ""; position: absolute; left: 12%; right: 12%; top: 0; height: 2px; background: linear-gradient(90deg, transparent, #2b5cff, #14b8e6, transparent); opacity: .85; }
.ua-card::after {
    content: ""; position: absolute; inset: 0; pointer-events: none;
    background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, .6) 50%, transparent 60%);
    transform: translateX(-130%);
    animation: uaSheen 10s ease-in-out 2s infinite;
}

.ua-card__brand { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 26px; font-size: 10.5px; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; color: var(--blue); }
.ua-card__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--grad); box-shadow: 0 0 0 4px rgba(43, 92, 255, .12); }

/* restyle the existing form markup */
.ua-card .py-20 { padding: 0 !important; }
.ua-card .py-2 { padding: 0 0 18px !important; }
.ua-card .card-body { padding: 0 !important; }
.ua-card h1, .ua-card .text-gray-900 {
    font-family: inherit !important; color: var(--ink) !important;
    font-size: 32px !important; font-weight: 800 !important; letter-spacing: -.04em; line-height: 1.1 !important;
    margin-bottom: 10px !important;
}
.ua-card .text-gray-500 { color: var(--muted) !important; font-size: 14px !important; font-weight: 500 !important; }
.ua-card .mb-10 { margin-bottom: 28px !important; }
.ua-card .mb-8 { margin-bottom: 14px !important; }
.ua-card .mb-7 { margin-bottom: 12px !important; }

.ua-card .form-control {
    width: 100%; height: 52px; padding: 0 18px !important;
    border: 1px solid rgba(18, 32, 84, .14) !important;
    border-radius: 15px !important;
    background: rgba(255, 255, 255, .85) !important;
    color: var(--ink) !important;
    font-family: inherit; font-size: 15px !important; font-weight: 500;
    box-shadow: 0 1px 2px rgba(24, 44, 120, .05) inset;
    transition: border-color .2s var(--ease), box-shadow .25s var(--ease), background .2s;
}
.ua-card .form-control::placeholder { color: var(--faint) !important; }
.ua-card .form-control:hover { border-color: rgba(43, 92, 255, .38) !important; }
.ua-card .form-control:focus {
    outline: 0; background: #fff !important; border-color: var(--blue) !important;
    box-shadow: 0 0 0 4px rgba(43, 92, 255, .14), 0 10px 26px -12px rgba(43, 92, 255, .55) !important;
}

.ua-card .btn-primary {
    width: 100%; height: 52px; margin: 0 !important; padding: 0 24px !important;
    position: relative; overflow: hidden;
    border: 0 !important; border-radius: 15px !important;
    background: var(--grad) !important; background-size: 170% 100% !important; background-position: 0 0 !important;
    color: #fff !important; font-family: inherit; font-size: 15px !important; font-weight: 700 !important; letter-spacing: -.005em;
    box-shadow: 0 16px 30px -12px rgba(43, 92, 255, .7), 0 1px 0 rgba(255, 255, 255, .45) inset !important;
    transition: transform .2s var(--ease), box-shadow .25s var(--ease), background-position .5s var(--ease);
}
.ua-card .btn-primary::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(115deg, transparent 35%, rgba(255, 255, 255, .45) 50%, transparent 65%);
    transform: translateX(-120%); transition: transform .8s var(--ease);
}
.ua-card .btn-primary:hover { transform: translateY(-2px); background-position: 100% 0 !important; box-shadow: 0 22px 38px -14px rgba(43, 92, 255, .8), 0 1px 0 rgba(255, 255, 255, .45) inset !important; }
.ua-card .btn-primary:hover::after { transform: translateX(120%); }
.ua-card .btn-primary:active { transform: translateY(0) scale(.98); }
.ua-card .btn-primary:focus-visible { outline: 0; box-shadow: 0 0 0 3px #fff, 0 0 0 6px rgba(43, 92, 255, .6) !important; }

.ua-card .d-flex.flex-stack { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ua-card .d-flex.flex-stack:last-of-type > .btn { flex: 1; }
.ua-card .link-primary { color: var(--blue) !important; font-size: 13.5px !important; font-weight: 700 !important; text-decoration: none; transition: color .2s; }
.ua-card .link-primary:hover { color: var(--cyan) !important; }
.ua-card a:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; border-radius: 6px; }
.ua-card .fs-5 { font-size: 13.5px !important; }

.ua-card .invalid-feedback { display: block; margin-top: 7px; color: #d93a40; font-size: 12.5px; font-weight: 600; }
.ua-card .alert { border-radius: 14px; padding: 13px 16px; font-size: 13.5px; font-weight: 600; margin-bottom: 18px; }
.ua-card .alert-success { background: rgba(14, 171, 122, .09); border: 1px solid rgba(14, 171, 122, .28); color: #087a58; }
.ua-card .alert-danger { background: rgba(229, 72, 77, .08); border: 1px solid rgba(229, 72, 77, .26); color: #b4272c; }

@keyframes uaRise { from { opacity: 0; transform: translate3d(0, 18px, 0); } to { opacity: 1; transform: none; } }

/* --------------------------------------------------------- responsive */
@media (max-width: 991.98px) {
    .ua-shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; row-gap: 28px; padding: 24px 20px 40px; align-items: start; }
    .ua-panel { order: 1; }
    .ua-hero { order: 2; max-width: 520px; margin: 0 auto; width: 100%; gap: 26px; }
    .ua-copy { text-align: center; }
    .ua-eyebrow { justify-content: center; }
    .ua-lead { margin-left: auto; margin-right: auto; font-size: 15px; }
    .ua-title { font-size: clamp(36px, 11vw, 54px); }
    .ua-stage { max-width: none; width: 100%; }
}

@media (max-width: 479.98px) {
    .ua-topbar { flex-wrap: wrap; gap: 10px 12px; }
    .ua-brand img { height: 22px; }
    .ua-lang a { padding: 4px 8px; font-size: 11.5px; }
    .ua-card { padding: 30px 22px 28px; border-radius: 24px; }
    .ua-card h1, .ua-card .text-gray-900 { font-size: 28px !important; }
    .ua-stage { --row: 42px; padding: 16px 16px 18px; border-radius: 22px; }
    .ua-label { font-size: 13px; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition-duration: .01ms !important; }
}

/* ------------------------------------------------ desktop: one screen, no scroll
   Everything is sized from the viewport height so hero + workflow card + form
   always fit in a single view. Stacked (mobile/tablet) layouts still scroll. */
@media (min-width: 992px) {
    html, body { height: 100%; overflow: hidden; }
    .ua-shell { height: 100vh; height: 100dvh; min-height: 0; padding-top: clamp(16px, 3vh, 40px); padding-bottom: clamp(16px, 3vh, 40px); overflow: hidden; }
    .ua-brand img { height: clamp(20px, 3vh, 26px); }
    .ua-hero { gap: clamp(12px, 2.6vh, 34px); }
    .ua-title { margin-top: clamp(6px, 1.4vh, 14px); font-size: clamp(36px, 8vh, 76px); }
    .ua-lead { margin-top: clamp(8px, 1.6vh, 18px); font-size: clamp(13px, 1.9vh, 16px); line-height: 1.5; }
    .ua-stage { --row: clamp(30px, 4.7vh, 46px); --node: clamp(24px, 3.7vh, 36px); padding: clamp(12px, 2vh, 20px) 22px clamp(12px, 2vh, 22px); }
    .ua-stage__head { margin-bottom: clamp(8px, 1.6vh, 16px); }
    .ua-progress { margin-top: clamp(8px, 1.6vh, 16px); }
    .ua-label { font-size: clamp(12.5px, 1.75vh, 14px); }
    .ua-card { padding-top: clamp(24px, 4vh, 40px); padding-bottom: clamp(22px, 3.6vh, 36px); max-height: 100%; }
    .ua-card__brand { margin-bottom: clamp(12px, 2.6vh, 26px); }
}
@media (min-width: 992px) and (max-height: 700px) {
    .ua-lead { display: none; }
}

.ua-lang { display: flex; gap: 4px; }
.ua-lang a { padding: 4px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-decoration: none; color: inherit; opacity: .7; border: 1px solid transparent; }
.ua-lang a:hover { opacity: 1; }
.ua-lang a.is-active { opacity: 1; border-color: currentColor; }
