.animate-rise {
    opacity: .94;
    transform: translateY(14px);
    animation: riseIn .45s ease forwards;
}

.animate-soft {
    opacity: .96;
    transform: translateY(10px) scale(.985);
    animation: softIn .5s ease forwards;
}

.delay-1 { animation-delay: .06s; }
.delay-2 { animation-delay: .12s; }
.delay-3 { animation-delay: .18s; }
.delay-4 { animation-delay: .24s; }
.delay-5 { animation-delay: .3s; }

.table tbody tr {
    transition: background-color var(--app-transition-fast), box-shadow var(--app-transition-fast);
}

.table tbody tr:hover {
    box-shadow: inset 3px 0 0 var(--app-table-hover-accent);
}

body.login-page {
    min-height: 100vh;
    background: var(--app-login-bg);
}

.form-help-icon {
    --bs-btn-padding-y: .05rem;
    --bs-btn-padding-x: .4rem;
    --bs-btn-font-size: .72rem;
    --bs-btn-line-height: 1.1;
    --bs-btn-border-radius: 999px;
    --bs-btn-border-color: var(--app-form-help-border);
    --bs-btn-color: var(--app-form-help-color);
    --bs-btn-bg: var(--app-form-help-bg);
    --bs-btn-hover-color: var(--app-heading);
    --bs-btn-hover-bg: var(--app-form-help-hover-bg);
    --bs-btn-hover-border-color: var(--app-form-help-hover-border);
    min-width: 1.4rem;
}

.admin-table {
    table-layout: fixed;
    font-size: .95rem;
    line-height: 1.35;
}

.admin-table th,
.admin-table td {
    vertical-align: middle;
    overflow-wrap: break-word;
    word-break: normal;
    hyphens: auto;
}

.admin-table th {
    white-space: nowrap;
    font-size: .84rem;
    font-weight: 700;
    letter-spacing: .01em;
}

.admin-table td small,
.admin-table td .small {
    font-size: .82rem;
}

.admin-actions {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: .375rem;
    width: 100%;
}

.admin-actions form {
    margin: 0;
}

.admin-page-header {
    min-height: 2.75rem;
}

.admin-page-header h1 {
    letter-spacing: 0;
}

.admin-page-action {
    flex: 0 0 auto;
    min-width: max-content;
}

.admin-filter-card .card-body {
    padding: 1rem 1.1rem;
}

.admin-filter-actions .btn {
    min-height: 3rem;
}

.admin-list-card .card-header {
    min-height: 3.75rem;
}

.admin-date {
    white-space: normal;
    line-height: 1.25;
}

.admin-catalog-table,
.registros-table,
.logs-table {
    table-layout: auto;
}

.admin-catalog-table td:first-child,
.registros-table td,
.logs-table td,
.logs-table pre {
    word-break: break-word;
    overflow-wrap: anywhere;
}

.admin-catalog-table th {
    white-space: nowrap;
}

.categorias-table th:nth-child(4),
.categorias-table td:nth-child(4),
.meios-table th:nth-child(3),
.meios-table td:nth-child(3),
.usuarios-table th:nth-child(4),
.usuarios-table td:nth-child(4),
.registros-table td:nth-child(4) {
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.admin-catalog-table .admin-actions {
    justify-content: flex-end;
    align-items: center;
    gap: .5rem;
    flex-wrap: nowrap;
    width: auto;
}

.admin-catalog-table .admin-actions :is(.btn, a, form) {
    width: auto;
}

.admin-catalog-table .admin-actions .btn {
    min-width: 0;
    white-space: nowrap;
}

.usuarios-table td:nth-child(1),
.usuarios-table td:nth-child(2) {
    word-break: break-word;
}

.usuarios-table .usuario-data-text {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.categorias-table th:nth-child(4),
.categorias-table td:nth-child(4),
.meios-table th:nth-child(3),
.meios-table td:nth-child(3) {
    min-width: 112px;
}

.categorias-table th:nth-child(5),
.categorias-table td:nth-child(5),
.meios-table th:nth-child(4),
.meios-table td:nth-child(4) {
    min-width: 286px;
    text-align: right;
    white-space: nowrap;
}

.usuarios-table th:nth-child(5),
.usuarios-table td:nth-child(5) {
    min-width: 146px;
}

.usuarios-table th:nth-child(6),
.usuarios-table td:nth-child(6) {
    min-width: 188px;
    text-align: right;
    white-space: nowrap;
}

.logs-table td,
.logs-table th {
    vertical-align: top;
}

.logs-table td:last-child {
    min-width: 124px;
}

.registros-table th:nth-child(1),
.registros-table td:nth-child(1) {
    min-width: 150px;
}

.registros-table th:nth-child(4),
.registros-table td:nth-child(4) {
    min-width: 110px;
}

.registros-table th:nth-child(5),
.registros-table td:nth-child(5) {
    min-width: 220px;
}

.registros-table td:nth-child(5) {
    font-family: var(--bs-font-monospace);
    font-size: .84rem;
}

.registros-table th:nth-child(6),
.registros-table td:nth-child(6) {
    min-width: 320px;
}

.registros-table td:nth-child(6) {
    font-size: .82rem;
    color: var(--app-text-muted);
}

.logs-table pre {
    white-space: pre-wrap;
}

.logs-table th:nth-child(1),
.logs-table td:nth-child(1) {
    min-width: 148px;
}

.logs-table th:nth-child(2),
.logs-table td:nth-child(2) {
    min-width: 120px;
}

.logs-table th:nth-child(3),
.logs-table td:nth-child(3) {
    min-width: 88px;
}

.logs-table td:nth-child(1),
.logs-table td:nth-child(2),
.logs-table td:nth-child(3) {
    font-size: .85rem;
}

.log-context-modal {
    border: 1px solid rgba(37, 45, 62, .9);
    background:
        radial-gradient(circle at top right, rgba(74, 144, 226, .16), transparent 28%),
        linear-gradient(180deg, rgba(16, 21, 31, .98), rgba(11, 16, 25, .98));
    color: #d8e1f3;
}

.log-context-modal .modal-header {
    border-bottom-color: rgba(107, 128, 168, .28);
    background: rgba(14, 19, 29, .72);
}

.log-context-modal .modal-body {
    padding: 0;
}

.log-context-modal-meta {
    color: rgba(186, 198, 224, .78);
    font-size: .83rem;
}

.log-context-modal-code {
    max-height: min(70vh, 860px);
    margin: 0;
    padding: 1.15rem 1.25rem;
    overflow: auto;
    background: transparent;
    color: #d8e1f3;
    font-family: var(--bs-font-monospace);
    font-size: .86rem;
    line-height: 1.65;
    white-space: pre-wrap;
    word-break: break-word;
}

.log-context-modal-code code {
    color: inherit;
}

.json-token-key {
    color: #8cc8ff;
}

.json-token-string {
    color: #c7ef9d;
}

.json-token-number {
    color: #ffca80;
}

.json-token-boolean {
    color: #f3a8ff;
}

.json-token-null {
    color: #ff8f8f;
}

@keyframes riseIn {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes softIn {
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

@media (max-width: 991.98px) {
    .table-responsive {
        border-radius: .75rem;
    }

    .admin-table {
        min-width: 760px;
        font-size: .9rem;
    }

    .admin-table th,
    .admin-table td {
        padding: .8rem .7rem;
    }

    .admin-actions {
        justify-content: flex-start;
        width: auto;
    }

    .admin-actions :is(.btn, form, a) {
        width: auto;
    }

    .admin-catalog-table {
        min-width: 760px;
    }

    .logs-table {
        min-width: 920px;
    }

    .registros-table {
        min-width: 980px;
    }
}

@media (max-width: 767.98px) {
    .admin-page-header {
        align-items: flex-start !important;
    }

    .admin-page-header h1 {
        font-size: 1.45rem;
    }

    .admin-page-header p {
        max-width: 26rem;
        font-size: .96rem;
        line-height: 1.35;
    }

    .admin-page-action {
        padding-inline: .9rem;
        white-space: normal;
    }

    .admin-filter-card .card-body {
        padding: .85rem;
    }

    .admin-filter-actions {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) auto;
    }

    .admin-list-card .card-header {
        min-height: 0;
        padding: .85rem .95rem;
    }

    .table-responsive {
        overflow: visible;
    }

    .admin-table {
        min-width: 0 !important;
    }

    .responsive-stack-table {
        width: 100%;
        min-width: 0 !important;
        table-layout: auto !important;
        border: 0;
        background: transparent;
    }

    .responsive-stack-table caption {
        margin-bottom: .75rem;
        font-size: 1rem;
    }

    .responsive-stack-table thead {
        position: absolute;
        width: 1px;
        height: 1px;
        margin: -1px;
        padding: 0;
        overflow: hidden;
        border: 0;
        clip: rect(0 0 0 0);
        clip-path: inset(50%);
        white-space: nowrap;
    }

    .responsive-stack-table tbody,
    .responsive-stack-table tr,
    .responsive-stack-table td {
        display: block;
        width: 100%;
    }

    .responsive-stack-table tbody {
        gap: .5rem;
    }

    .responsive-stack-table tr {
        overflow: hidden;
        margin-bottom: .55rem;
        border: 1px solid var(--app-responsive-row-border);
        border-radius: var(--app-radius-sm);
        background: var(--app-responsive-row-bg);
        box-shadow: var(--app-responsive-row-shadow);
    }

    .responsive-stack-table td {
        display: grid;
        grid-template-columns: minmax(84px, 31%) minmax(0, 1fr);
        align-items: start;
        gap: .42rem;
        padding: .48rem .62rem !important;
        border-bottom: 1px solid var(--app-responsive-cell-border);
        text-align: left !important;
        overflow-wrap: break-word;
        word-break: break-word;
    }

    .responsive-stack-table td:last-child {
        border-bottom: 0;
    }

    .responsive-stack-table td::before {
        content: attr(data-label);
        display: block;
        color: var(--app-responsive-label-color);
        font-size: .64rem;
        font-weight: 700;
        letter-spacing: .08em;
        text-transform: uppercase;
        line-height: 1.25;
        white-space: nowrap;
    }

    .responsive-stack-table td > * {
        min-width: 0;
    }

    .responsive-stack-table td p,
    .responsive-stack-table td small,
    .responsive-stack-table td .small {
        margin-bottom: 0;
    }

    .responsive-stack-table td .badge,
    .responsive-stack-table td .btn,
    .responsive-stack-table td .form-check,
    .responsive-stack-table td .lock-toggle {
        justify-self: start;
    }

    .responsive-stack-table .admin-actions,
    .responsive-stack-table .dashboard-acoes {
        display: flex;
        flex-wrap: wrap;
        justify-content: flex-start;
        align-items: center;
        gap: .28rem;
        width: auto;
    }

    .responsive-stack-table .admin-actions :is(.btn, form, a),
    .responsive-stack-table .dashboard-acoes :is(.btn, a, form) {
        width: auto;
    }

    .responsive-stack-table .admin-actions .btn,
    .responsive-stack-table .dashboard-acoes .btn {
        padding: .32rem .5rem;
    }

    .responsive-stack-table .entry-actions-state {
        justify-self: start;
    }

    .responsive-stack-table .lock-toggle {
        padding: .24rem .58rem;
        font-size: .8rem;
    }

    .responsive-stack-table .text-end,
    .responsive-stack-table .text-center {
        text-align: left !important;
    }

    .responsive-stack-table .text-nowrap {
        white-space: normal !important;
    }

    .admin-catalog-table.responsive-stack-table td {
        grid-template-columns: minmax(104px, 32%) minmax(0, 1fr);
        gap: .45rem;
    }

    .admin-catalog-table.responsive-stack-table td::before {
        margin-bottom: .1rem;
    }

    .admin-catalog-table.responsive-stack-table .admin-actions {
        justify-content: flex-start;
        gap: .5rem;
    }

    :is(.admin-catalog-table, .usuarios-table).responsive-stack-table {
        background: transparent;
    }

    :is(.admin-catalog-table, .usuarios-table).responsive-stack-table tbody {
        display: block;
    }

    .admin-catalog-table.responsive-stack-table td {
        display: flex;
        grid-template-columns: none;
        align-items: center;
        justify-content: space-between;
        gap: .75rem;
        width: 100% !important;
        padding: 0 !important;
        border-bottom: 0;
    }

    .admin-catalog-table.responsive-stack-table tr {
        display: grid;
        gap: .5rem;
        margin-bottom: .7rem;
        padding: .68rem;
        border-radius: var(--app-radius-md);
    }

    .admin-catalog-table.responsive-stack-table td:first-child {
        display: block;
        font-size: 1.03rem;
        font-weight: 650;
        line-height: 1.25;
    }

    .admin-catalog-table.responsive-stack-table td:first-child::before {
        margin-bottom: .25rem;
    }

    .admin-catalog-table.responsive-stack-table td:last-child {
        display: block;
        padding-top: .65rem !important;
        border-top: 1px solid var(--app-responsive-cell-border);
    }

    .admin-catalog-table.responsive-stack-table .admin-actions {
        width: 100%;
        gap: .45rem;
    }

    .admin-catalog-table.responsive-stack-table .admin-actions .btn {
        min-height: 2.15rem;
    }

    .usuarios-table.responsive-stack-table td {
        display: flex;
        flex-direction: column;
        align-items: flex-start;
        gap: .3rem;
        width: 100% !important;
        padding: 0 !important;
        border-bottom: 0;
        overflow-wrap: normal;
        word-break: normal;
    }

    .usuarios-table.responsive-stack-table tr {
        display: grid;
        gap: .7rem;
        margin-bottom: .8rem;
        padding: .9rem;
        border-radius: var(--app-radius-md);
    }

    .usuarios-table.responsive-stack-table td::before {
        margin-bottom: 0;
        white-space: normal;
    }

    .usuarios-table.responsive-stack-table .usuario-nome-cell {
        gap: .45rem;
        padding-bottom: .75rem !important;
        border-bottom: 1px solid var(--app-responsive-cell-border);
        font-size: 1.05rem;
        font-weight: 650;
        line-height: 1.3;
    }

    .usuarios-table.responsive-stack-table .usuario-nome-cell .badge {
        margin-left: 0 !important;
    }

    .usuarios-table.responsive-stack-table .usuario-login-cell,
    .usuarios-table.responsive-stack-table .usuario-perfil-cell,
    .usuarios-table.responsive-stack-table .usuario-total-cell,
    .usuarios-table.responsive-stack-table .usuario-criado-cell {
        gap: .2rem;
    }

    .usuarios-table.responsive-stack-table .usuario-total-cell {
        font-variant-numeric: tabular-nums;
    }

    .usuarios-table.responsive-stack-table .usuario-data-text {
        white-space: nowrap;
        font-variant-numeric: tabular-nums;
    }

    .usuarios-table.responsive-stack-table .usuario-acoes-cell {
        padding-top: .75rem !important;
        border-top: 1px solid var(--app-responsive-cell-border);
    }

    .usuarios-table.responsive-stack-table .usuario-acoes {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .55rem;
        width: 100%;
    }

    .usuarios-table.responsive-stack-table .usuario-acoes .btn {
        width: 100%;
        min-height: 2.5rem;
        justify-content: center;
    }

    .usuarios-table.responsive-stack-table .usuario-acoes .btn:only-child {
        grid-column: 1 / -1;
    }
}

@media (max-width: 575.98px) {
    .table-responsive {
        margin-inline: -.25rem;
        padding-inline: .25rem;
    }

    .admin-table {
        min-width: 720px;
        font-size: .88rem;
    }

    .admin-catalog-table.admin-table {
        min-width: 0 !important;
    }

    .admin-table th {
        font-size: .78rem;
    }

    .admin-table th,
    .admin-table td {
        padding: .75rem .65rem;
    }

    .admin-actions {
        gap: .3rem;
    }

    .admin-actions .btn {
        padding: .35rem .6rem;
        font-size: .8rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .animate-rise,
    .animate-soft {
        opacity: 1;
        transform: none;
        animation: none;
    }

    .card,
    .table-responsive,
    .alert,
    .btn,
    .form-control,
    .form-select,
    .modal-content,
    .table tbody tr {
        transition: none;
    }
}
