.rx {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
    background: var(--bg-alt);
}

/* ----- Painel institucional ----- */
.rx__aside {
    position: relative;
    color: #fff;
    padding: 48px 56px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 40px;
    background:
        linear-gradient(160deg, rgba(11, 31, 68, .92), rgba(36, 88, 175, .86)),
        url('../img/estrutura.webp') center/cover no-repeat;
}

.rx__aside h1 {
    font-family: var(--font-title);
    font-size: clamp(1.8rem, 3vw, 2.6rem);
    line-height: 1.15;
    margin: 16px 0 14px;
    color: #fff;
}

.rx__aside p {
    color: rgba(255, 255, 255, .85);
    max-width: 46ch;
}

.rx__steps {
    list-style: none;
    padding: 0;
    margin: 28px 0 0;
    display: grid;
    gap: 14px;
}

.rx__steps li {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    color: rgba(255, 255, 255, .9);
}

.rx__steps b {
    flex: 0 0 28px;
    height: 28px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .16);
    font-family: var(--font-title);
    font-size: .85rem;
}

.rx__back {
    color: #fff;
    opacity: .85;
    font-size: .95rem;
}

.rx__back:hover {
    opacity: 1;
    text-decoration: underline;
}

/* ----- Formulário ----- */
.rx__main {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px 24px;
}

.rx__card {
    width: 100%;
    max-width: 420px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    padding: 40px 36px;
}

.rx__logo {
    display: block;
    width: 170px;
    height: auto;
    margin: 0 auto 24px;
}

.rx__card h2 {
    font-family: var(--font-title);
    font-size: 1.4rem;
    color: var(--navy);
    text-align: center;
    margin: 0 0 6px;
}

.rx__card .rx__sub {
    text-align: center;
    color: var(--muted);
    font-size: .95rem;
    margin: 0 0 28px;
}

.rx__field {
    display: grid;
    gap: 6px;
    margin-bottom: 18px;
}

.rx__field label {
    font-family: var(--font-title);
    font-weight: 500;
    font-size: .9rem;
    color: var(--text);
}

.rx__input {
    position: relative;
}

.rx__input input {
    width: 100%;
    height: 50px;
    padding: 0 48px 0 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font: inherit;
    font-size: 1rem;
    color: var(--text);
    background: #fff;
    transition: border-color .2s, box-shadow .2s;
}

.rx__input input:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 4px rgba(36, 88, 175, .14);
}

.rx__input input[aria-invalid="true"] {
    border-color: #c62828;
}

.rx__toggle {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 38px;
    height: 38px;
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
    border-radius: 8px;
    display: grid;
    place-items: center;
}

.rx__toggle:hover {
    color: var(--blue);
}

.rx__toggle svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rx__hint {
    font-size: .82rem;
    color: var(--muted);
}

.rx__alert {
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: .92rem;
    margin-bottom: 18px;
    background: #fdecea;
    color: #8e1c1c;
    border: 1px solid #f5c2bd;
}

.rx__submit {
    width: 100%;
    justify-content: center;
    height: 52px;
}

.rx__submit[disabled] {
    opacity: .7;
    cursor: wait;
}

.rx__spinner {
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255, 255, 255, .4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: rx-spin .8s linear infinite;
}

@keyframes rx-spin {
    to {
        transform: rotate(360deg);
    }
}

.rx__help {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--border);
    text-align: center;
    font-size: .9rem;
    color: var(--muted);
}

.rx__help a {
    color: var(--blue);
    font-weight: 500;
}

.rx__lgpd {
    margin-top: 16px;
    font-size: .78rem;
    color: var(--muted);
    text-align: center;
}

/* `hidden` precisa vencer o display:grid/flex das classes */
.rx[hidden],
.rv[hidden],
.rv [hidden] {
    display: none !important;
}

/* =========================================================
   Tela de resultados (após login)
   ========================================================= */
.rv {
    min-height: 100vh;
    background: var(--bg-alt);
    padding-bottom: 48px;
}

.rv__bar {
    background: #fff;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
}

.rv__bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: 72px;
    gap: 16px;
}

.rv__logo {
    display: block;
    width: 150px;
    height: auto;
}

.rv__logout {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 42px;
    padding: 0 18px;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    background: #fff;
    color: var(--navy);
    font: 500 .92rem var(--font-title);
    cursor: pointer;
    transition: border-color .2s, color .2s;
}

.rv__logout:hover {
    border-color: var(--blue);
    color: var(--blue);
}

.rv__logout svg,
.rv__btn svg,
.rv__empty svg {
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.rv__logout svg {
    width: 18px;
    height: 18px;
}

.rv__hero {
    color: #fff;
    padding: 40px 0 88px;
    background: linear-gradient(135deg, var(--navy), var(--blue));
}

.rv__hero h1 {
    font-family: var(--font-title);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    color: #fff;
    margin: 12px 0 6px;
}

.rv__hero p {
    color: rgba(255, 255, 255, .85);
    margin: 0;
}

.rv__hero strong {
    color: #fff;
    text-transform: uppercase;
}

.rv__main {
    margin-top: -56px;
}

.rv__card {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

.rv__toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.rv__count {
    margin: 0;
    font-family: var(--font-title);
    font-weight: 600;
    color: var(--navy);
}

.rv__search {
    margin: 0;
    max-width: 340px;
    flex: 1 1 260px;
}

.rv__alert {
    margin: 16px 24px 0;
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    font-size: .92rem;
    background: #fdecea;
    color: #8e1c1c;
    border: 1px solid #f5c2bd;
}

.rv__alert a {
    color: inherit;
    font-weight: 600;
    text-decoration: underline;
}

/* Linhas: grid compartilhado entre cabeçalho e itens */
.rv__head,
.rv__item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 120px 150px 220px;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
}

.rv__head {
    height: 44px;
    background: var(--bg-alt);
    font: 600 .78rem var(--font-title);
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}

.rv__list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rv__item {
    min-height: 68px;
    padding-top: 12px;
    padding-bottom: 12px;
    border-top: 1px solid var(--border);
    transition: background .2s;
}

.rv__item:hover {
    background: var(--sky-soft);
}

.rv__name {
    font-family: var(--font-title);
    font-weight: 500;
    color: var(--text);
    line-height: 1.35;
}

.rv__code {
    font-variant-numeric: tabular-nums;
    color: var(--muted);
    font-size: .92rem;
}

.rv__date {
    font-variant-numeric: tabular-nums;
    color: var(--text);
    font-size: .92rem;
}

.rv__date small {
    display: block;
    color: var(--muted);
    font-size: .8rem;
}

.rv__actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
}

.rv__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 38px;
    padding: 0 14px;
    border-radius: 999px;
    border: 1.5px solid var(--blue);
    background: #fff;
    color: var(--blue);
    font: 500 .85rem var(--font-title);
    cursor: pointer;
    white-space: nowrap;
    transition: background .2s, color .2s;
}

.rv__btn:hover {
    background: var(--blue);
    color: #fff;
}

.rv__btn--solid {
    background: var(--blue);
    color: #fff;
}

.rv__btn--solid:hover {
    background: var(--blue-dark);
    border-color: var(--blue-dark);
}

.rv__btn[disabled] {
    opacity: .6;
    cursor: wait;
}

.rv__btn svg {
    width: 16px;
    height: 16px;
}

.rv__empty {
    text-align: center;
    padding: 56px 24px;
    color: var(--muted);
}

.rv__empty svg {
    width: 44px;
    height: 44px;
    color: var(--sky);
    margin-bottom: 8px;
}

.rv__note {
    margin-top: 24px;
    text-align: center;
    font-size: .9rem;
    color: var(--muted);
}

.rv__note a {
    color: var(--blue);
    font-weight: 500;
}

@media (max-width: 760px) {
    .rv__head {
        display: none;
    }

    .rv__toolbar {
        padding: 16px;
    }

    .rv__search {
        max-width: none;
    }

    .rv__item {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "name name"
            "code date"
            "actions actions";
        gap: 6px 12px;
        padding: 16px;
    }

    .rv__name {
        grid-area: name;
    }

    .rv__code {
        grid-area: code;
    }

    .rv__code::before {
        content: "Cód. ";
    }

    .rv__date {
        grid-area: date;
        text-align: right;
    }

    .rv__date small {
        display: inline;
        margin-left: 4px;
    }

    .rv__actions {
        grid-area: actions;
        justify-content: stretch;
        margin-top: 8px;
    }

    .rv__btn {
        flex: 1;
        justify-content: center;
    }
}

@media (max-width: 900px) {
    .rx {
        grid-template-columns: 1fr;
    }

    .rx__aside {
        padding: 32px 20px;
        gap: 20px;
    }

    .rx__steps {
        display: none;
    }

    .rx__main {
        padding: 28px 16px 40px;
    }

    .rx__card {
        padding: 32px 22px;
    }
}