:root {
    --night: #071421;
    --deep: #0a1b2a;
    --panel: #0d2233;
    --line: #214258;
    --ice: #edf6fb;
    --muted: #91a9b8;
    --cyan: #32b8d8;
    --amber: #f2b84b;
    --green: #42d3a1;
    --red: #ef6b6b;
    color-scheme: dark;
}

* { box-sizing: border-box; }

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

body {
    margin: 0;
    background: var(--night);
    color: var(--ice);
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    line-height: 1.45;
}

.portal-entry {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(560px, 1.45fr) minmax(390px, .75fr);
}

.service-catalog {
    padding: 42px clamp(32px, 5vw, 84px) 48px;
    background:
        linear-gradient(90deg, rgba(50,184,216,.055) 1px, transparent 1px) 0 0 / 42px 42px,
        linear-gradient(rgba(50,184,216,.04) 1px, transparent 1px) 0 0 / 42px 42px,
        var(--night);
}

.catalog-header {
    display: flex;
    align-items: center;
    margin-bottom: 34px;
}

.portal-mark {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--ice);
    text-decoration: none;
    font-size: 24px;
    letter-spacing: -.02em;
}

.portal-mark img { width: 52px; height: 52px; }
.portal-mark strong { color: var(--cyan); }

.service-list { display: grid; gap: 10px; }

.service-card {
    --accent: var(--cyan);
    display: grid;
    grid-template-columns: minmax(205px, .72fr) 1.3fr;
    gap: 28px;
    align-items: center;
    padding: 18px 20px;
    border: 1px solid rgba(94,139,164,.28);
    border-left: 3px solid var(--accent);
    background: rgba(10,27,42,.84);
}

.service-log { --accent: #f2b84b; }
.service-sentinel { --accent: #42d3a1; }
.service-xdr { --accent: #32b8d8; }
.service-unm { --accent: #8ca7ff; }
.service-ucorius { --accent: #d08cff; }

.service-name { display: flex; align-items: center; gap: 14px; }
.service-name > span {
    display: grid;
    place-items: center;
    flex: 0 0 42px;
    height: 42px;
    border: 1px solid color-mix(in srgb, var(--accent) 65%, transparent);
    color: var(--accent);
    font-weight: 750;
    font-size: 13px;
}
.service-name h2 { margin: 0; font-size: 17px; letter-spacing: -.02em; }
.service-name p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.service-card ul {
    columns: 2;
    column-gap: 32px;
    margin: 0;
    padding-left: 17px;
    color: #bed0db;
    font-size: 12px;
}
.service-card li { margin: 4px 0; break-inside: avoid; }
.service-card li::marker { color: var(--accent); }

.login-side {
    display: grid;
    align-items: center;
    padding: 46px clamp(30px, 4vw, 66px);
    background: var(--deep);
    border-left: 1px solid var(--line);
}

.login-panel { width: 100%; max-width: 430px; margin: auto; }
.portal-view[hidden] { display: none; }
.login-context { color: var(--muted); font-size: 13px; }
.login-context span {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 8px;
    border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 14px rgba(66,211,161,.6);
}
.login-panel h2 { margin: 16px 0 8px; font-size: 32px; letter-spacing: -.035em; }
.login-copy { margin: 0 0 24px; color: var(--muted); font-size: 14px; }
.login-panel label { display: block; margin: 16px 0 7px; color: #c8d8e2; font-size: 13px; }
.login-panel input {
    width: 100%;
    height: 48px;
    padding: 0 14px;
    border: 1px solid #29495d;
    border-radius: 4px;
    outline: none;
    background: #081824;
    color: var(--ice);
    font: inherit;
    transition: border-color .15s, box-shadow .15s;
}
.login-panel input:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(50,184,216,.13); }
.login-panel input.is-invalid { border-color: var(--red); background: rgba(239,107,107,.07); }
.login-panel input:disabled { opacity: .55; cursor: not-allowed; }

.portal-field-help {
    margin: 6px 0 0;
    color: #7c97a8;
    font-size: 11.5px;
}

.portal-field-error {
    margin: 6px 0 0;
    color: #ff9c9c;
    font-size: 12px;
}

.portal-submit {
    width: 100%;
    height: 50px;
    margin-top: 22px;
    border: 0;
    border-radius: 4px;
    background: var(--cyan);
    color: #04131d;
    font-family: inherit;
    font-size: 14px;
    font-weight: 750;
    cursor: pointer;
    transition: filter .15s, opacity .15s;
}
.portal-submit:hover:not(:disabled) { filter: brightness(1.06); }
.portal-submit:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.portal-submit-link {
    display: grid;
    place-items: center;
    text-decoration: none;
}

/* ───────────────────────── CTA Criar Cadastro ───────────────────────── */
.portal-signup-cta {
    margin-top: 22px;
}

.portal-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    color: #7c97a8;
    font-size: 12px;
}
.portal-divider::before,
.portal-divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.portal-secondary-btn {
    width: 100%;
    height: 46px;
    border: 1px solid rgba(50,184,216,.55);
    border-radius: 4px;
    background: rgba(50,184,216,.08);
    color: var(--ice);
    font-family: inherit;
    font-size: 14px;
    font-weight: 650;
    cursor: pointer;
    transition: background .15s, border-color .15s;
}
.portal-secondary-btn:hover {
    background: rgba(50,184,216,.16);
    border-color: var(--cyan);
}
.portal-secondary-btn:focus-visible {
    outline: 2px solid var(--amber);
    outline-offset: 3px;
}

.portal-signup-hint {
    margin: 9px 0 0;
    text-align: center;
    color: #7c97a8;
    font-size: 11.5px;
}

/* ───────────────────────── Alertas ───────────────────────── */
.portal-alert {
    margin: 16px 0;
    padding: 11px 13px;
    border-left: 3px solid var(--amber);
    border-radius: 0 4px 4px 0;
    background: rgba(242,184,75,.11);
    color: var(--ice);
    font-size: 13px;
}
.portal-alert-danger {
    border-color: var(--red);
    background: rgba(239,107,107,.12);
}
.portal-alert-warning {
    border-color: var(--amber);
    background: rgba(242,184,75,.11);
}
.portal-alert-info {
    border-color: var(--cyan);
    background: rgba(50,184,216,.11);
}
.portal-alert-success {
    border-color: var(--green);
    background: rgba(66,211,161,.12);
}

/* ───────────────────────── OTP 6 dígitos & Credenciais ───────────────────────── */
.portal-target-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #081824;
    font-size: 12px;
    color: var(--muted);
}
.portal-target-chip strong {
    color: var(--ice);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.portal-otp-group {
    margin: 10px 0 18px;
}
.portal-group-label {
    display: block;
    margin-bottom: 8px;
    color: #c8d8e2;
    font-size: 13px;
}
.portal-otp-inputs {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
}
.login-panel input.portal-otp-slot {
    width: 50px;
    min-width: 0;
    flex: 1 1 0;
    height: 54px;
    padding: 0;
    text-align: center;
    font-size: 22px;
    font-weight: 700;
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}
.portal-otp-sep {
    color: #5c788a;
    font-weight: 700;
    font-size: 16px;
    user-select: none;
}

.portal-otp-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 10px;
    font-size: 12px;
    color: var(--muted);
}
.portal-otp-meta strong {
    color: var(--amber);
    font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.portal-cred-group {
    margin: 18px 0 0;
    padding: 16px 0 0;
    border: 0;
    border-top: 1px solid var(--line);
}
.portal-cred-group legend {
    padding: 0 8px 0 0;
    color: var(--cyan);
    font-size: 12px;
    font-weight: 650;
    letter-spacing: .04em;
    text-transform: uppercase;
}
.portal-cred-group label:first-of-type { margin-top: 10px; }

.portal-password-wrap {
    position: relative;
    display: flex;
    align-items: center;
}
.portal-password-wrap input {
    padding-right: 78px;
}
.portal-pass-toggle {
    position: absolute;
    right: 8px;
    height: 32px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--panel);
    color: var(--muted);
    font-family: inherit;
    font-size: 11.5px;
    cursor: pointer;
}
.portal-pass-toggle:hover { color: var(--ice); border-color: var(--cyan); }
.portal-pass-toggle:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

.portal-step-links {
    margin-top: 16px;
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}
.portal-step-links-split {
    justify-content: space-between;
}

.portal-link-btn {
    padding: 2px 0;
    border: 0;
    background: transparent;
    color: #9ccddd;
    font-family: inherit;
    font-size: 12.5px;
    text-decoration: underline;
    text-underline-offset: 3px;
    cursor: pointer;
}
.portal-link-btn:hover:not(:disabled) { color: var(--ice); }
.portal-link-btn:disabled {
    color: #5b7280;
    text-decoration: none;
    cursor: not-allowed;
}
.portal-link-btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }

/* ───────────────────────── Tela de Sucesso / Escopo ───────────────────────── */
.portal-scope-summary {
    display: grid;
    gap: 12px;
    margin: 18px 0 8px;
}
.portal-scope-block {
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--green);
    border-radius: 4px;
    background: #081824;
}
.portal-scope-restricted {
    border-left-color: var(--muted);
}
.portal-scope-block h3 {
    margin: 0 0 8px;
    font-size: 12px;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--green);
}
.portal-scope-restricted h3 { color: var(--muted); }
.portal-scope-block ul {
    margin: 0;
    padding-left: 18px;
    font-size: 12.5px;
    color: #c8d8e2;
}
.portal-scope-block li { margin: 4px 0; }

.login-panel footer { display: flex; justify-content: space-between; gap: 20px; margin-top: 30px; color: #667f8f; font-size: 11px; }
.login-panel footer a { color: #9ccddd; }

@keyframes portal-shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}
.portal-shake { animation: portal-shake .32s ease; }

@media (max-width: 980px) {
    .portal-entry { display: flex; flex-direction: column; }
    .login-side { order: -1; min-height: 100vh; border: 0; }
    .service-catalog { padding: 34px 22px; }
    .service-card { grid-template-columns: 1fr; gap: 12px; }
}

@media (max-width: 600px) {
    .login-side { padding: 28px 18px; }
    .login-panel h2 { font-size: 27px; }
    .service-card ul { columns: 1; }
    .login-panel footer { flex-direction: column; gap: 8px; }
    .portal-step-links-split { flex-direction: column; align-items: center; }
    .login-panel input.portal-otp-slot { height: 48px; font-size: 19px; }
}

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