/* =========================================================
   Interface corporativa moderna
   Tipografia: peso regular nos textos comuns; destaque reservado
   a títulos, valores principais, status e ações relevantes.
   Visual sóbrio, elegante, jovem e responsivo
   Compatível com a estrutura de classes do CSS original
   ========================================================= */

:root {
    color-scheme: light;

    --bg: #f4f6f8;
    --bg-soft: #eef2f5;
    --surface: #ffffff;
    --surface-2: #f8fafb;
    --surface-3: #f1f4f6;

    --text: #18212b;
    --text-soft: #364554;
    --muted: #687786;
    --line: #dce3e8;
    --line-strong: #c8d2da;

    --primary: #164e63;
    --primary-2: #103e50;
    --primary-soft: #e8f2f4;
    --accent: #4f7f78;
    --accent-2: #3f6964;
    --accent-soft: #e8f1ef;

    --success: #26725a;
    --success-soft: #e8f5ef;
    --danger: #a94343;
    --danger-soft: #faeeee;
    --warning: #956d26;
    --warning-soft: #faf3e3;
    --info: #416b8a;
    --info-soft: #eaf2f8;

    --sidebar: #172a35;
    --sidebar-2: #203945;
    --sidebar-text: #f5f7f8;
    --sidebar-muted: #aebbc3;

    --shadow-xs: 0 1px 2px rgba(18, 33, 43, .05);
    --shadow-sm: 0 6px 18px rgba(18, 33, 43, .06);
    --shadow: 0 14px 34px rgba(18, 33, 43, .08);
    --shadow-lg: 0 28px 70px rgba(13, 29, 39, .16);

    --radius-sm: 8px;
    --radius-md: 12px;
    --radius: 16px;
    --radius-lg: 22px;

    --transition: 180ms cubic-bezier(.2, .8, .2, 1);
}

* {
    box-sizing: border-box;
}

html {
    min-width: 320px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background: var(--bg);
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(circle at 92% -10%, rgba(79, 127, 120, .10), transparent 34rem),
        linear-gradient(180deg, #f7f9fa 0%, var(--bg) 46%, #f2f5f7 100%);
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
select,
summary {
    cursor: pointer;
}

button,
a,
input,
select,
textarea,
summary {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
    outline: 3px solid rgba(22, 78, 99, .20);
    outline-offset: 2px;
}

::selection {
    color: #fff;
    background: var(--primary);
}

::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    border: 3px solid transparent;
    border-radius: 999px;
    background: #aebbc3;
    background-clip: padding-box;
}

::-webkit-scrollbar-thumb:hover {
    background: #8797a2;
    background-clip: padding-box;
}

.hidden {
    display: none !important;
}

.text-right {
    text-align: right;
}

.eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--accent-2);
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .14em;
    text-transform: uppercase;
}

/* Login */
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 28px;
}

.login-card {
    position: relative;
    width: min(450px, 100%);
    padding: clamp(26px, 5vw, 38px);
    overflow: hidden;
    border: 1px solid rgba(200, 210, 218, .85);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, .94);
    box-shadow: var(--shadow-lg);
    backdrop-filter: blur(18px);
}

.login-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto;
    height: 4px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
}

.brand {
    display: flex;
    align-items: center;
    gap: 13px;
    min-width: 0;
}

.brand h1,
.brand p {
    margin: 0;
}

.brand h1 {
    color: var(--text);
    font-size: 1.08rem;
    font-weight: 700;
    letter-spacing: -.015em;
}

.brand p {
    margin-top: 3px;
    overflow: hidden;
    color: var(--muted);
    font-size: .8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.brand--login {
    margin-bottom: 30px;
}

.brand--login h1 {
    font-size: 1.42rem;
}

.brand__mark {
    width: 48px;
    height: 48px;
    display: grid;
    flex: none;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .14);
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, var(--primary), var(--accent-2));
    box-shadow: 0 10px 24px rgba(22, 78, 99, .23);
    font-weight: 800;
    letter-spacing: -.06em;
}

.form-stack {
    display: grid;
    gap: 16px;
}

.api-config {
    margin-top: 22px;
    padding-top: 17px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .84rem;
}

.api-config summary {
    margin-bottom: 12px;
    font-weight: 500;
}

/* Estrutura principal */
.app {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 258px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 22px 15px;
    overflow-y: auto;
    color: var(--sidebar-text);
    background:
        radial-gradient(circle at 10% 0%, rgba(79, 127, 120, .18), transparent 17rem),
        linear-gradient(180deg, var(--sidebar-2), var(--sidebar));
    border-right: 1px solid rgba(255, 255, 255, .06);
    box-shadow: 8px 0 28px rgba(15, 33, 43, .08);
}

.sidebar::after {
    content: "";
    position: absolute;
    inset: 0 0 0 auto;
    width: 2px;
    background: linear-gradient(180deg, transparent, rgba(112, 166, 157, .7), transparent);
}

.sidebar .brand {
    padding: 2px 9px 23px;
}

.sidebar .brand h1,
.sidebar .brand > span:last-child strong {
    color: #fff;
    font-weight: 700;
}

.sidebar .brand p {
    color: var(--sidebar-muted);
}

.nav {
    display: grid;
    gap: 5px;
}

.nav__item {
    position: relative;
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 13px;
    border: 1px solid transparent;
    border-radius: 11px;
    color: #c5d0d6;
    background: transparent;
    text-align: left;
    font-size: .88rem;
    font-weight: 500;
    transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--transition);
}

.nav__item::before {
    content: "";
    width: 3px;
    height: 18px;
    flex: none;
    border-radius: 999px;
    background: transparent;
    transition: background var(--transition), box-shadow var(--transition);
}

.nav__item:hover {
    color: #fff;
    background: rgba(255, 255, 255, .065);
    border-color: rgba(255, 255, 255, .055);
    transform: translateX(2px);
}

.nav__item.active {
    color: #fff;
    background: rgba(112, 166, 157, .15);
    border-color: rgba(145, 193, 185, .18);
    box-shadow: inset 0 1px rgba(255, 255, 255, .035);
}

.nav__item.active::before {
    background: #87b7af;
    box-shadow: 0 0 14px rgba(135, 183, 175, .45);
}

.sidebar__footer {
    margin-top: auto;
    display: grid;
    gap: 4px;
    padding: 17px 9px 2px;
    border-top: 1px solid rgba(255, 255, 255, .09);
}

.sidebar__footer strong {
    color: #f5f7f8;
    font-size: .88rem;
    font-weight: 600;
}

.sidebar__footer span {
    color: var(--sidebar-muted);
    font-size: .75rem;
}

.workspace {
    min-width: 0;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 15;
    min-height: 78px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 15px clamp(20px, 3vw, 38px);
    border-bottom: 1px solid rgba(220, 227, 232, .9);
    background: rgba(248, 250, 251, .88);
    box-shadow: 0 1px 0 rgba(255, 255, 255, .8);
    backdrop-filter: blur(18px) saturate(130%);
}

.topbar h2,
.topbar p {
    margin: 0;
}

.topbar h2 {
    color: var(--text);
    font-size: clamp(1.15rem, 2vw, 1.38rem);
    font-weight: 700;
    letter-spacing: -.025em;
}

.topbar p {
    margin-top: 3px;
    color: var(--muted);
    font-size: .8rem;
}

.topbar__actions,
.actions {
    display: flex;
    align-items: center;
    gap: 9px;
    flex-wrap: wrap;
}

.tenant-select {
    min-height: 40px;
    max-width: 270px;
    padding: 0 34px 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    color: var(--text-soft);
    background-color: var(--surface);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.tenant-select:hover {
    border-color: #aebbc3;
}

.tenant-select:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(22, 78, 99, .10);
    outline: 0;
}

/* Status */
.status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid transparent;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
    white-space: nowrap;
}

.status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 13%, transparent);
}

.status--warning {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: #ead9ad;
}

.status--success {
    color: var(--success);
    background: var(--success-soft);
    border-color: #c4dfd3;
}

.status--danger {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #edcaca;
}

/* Conteúdo */
.page {
    display: none;
    padding: 30px clamp(20px, 3vw, 38px) 52px;
    animation: page-in 220ms ease both;
}

.page.active {
    display: block;
}

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

.hero {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 30px;
    min-height: 210px;
    padding: clamp(28px, 4vw, 42px);
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: var(--radius-lg);
    color: #fff;
    background:
        radial-gradient(circle at 85% 15%, rgba(123, 177, 167, .22), transparent 21rem),
        linear-gradient(135deg, #173946 0%, #164e63 52%, #315f63 100%);
    box-shadow: 0 20px 46px rgba(22, 59, 70, .17);
}

.hero::after {
    content: "";
    position: absolute;
    right: -58px;
    bottom: -92px;
    width: 260px;
    height: 260px;
    border: 1px solid rgba(255, 255, 255, .09);
    border-radius: 50%;
    box-shadow:
        0 0 0 35px rgba(255, 255, 255, .025),
        0 0 0 76px rgba(255, 255, 255, .018);
    pointer-events: none;
}

.hero > * {
    position: relative;
    z-index: 1;
}

.hero h3,
.hero p {
    margin: 0;
}

.hero h3 {
    max-width: 720px;
    font-size: clamp(1.55rem, 3vw, 2.35rem);
    line-height: 1.12;
    letter-spacing: -.035em;
}

.hero p {
    max-width: 720px;
    margin-top: 12px;
    color: rgba(255, 255, 255, .75);
    font-size: .94rem;
    line-height: 1.65;
}

.hero .eyebrow {
    color: #a9d1ca;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-top: 20px;
}

.stat,
.card {
    border: 1px solid rgba(220, 227, 232, .95);
    border-radius: var(--radius);
    background: rgba(255, 255, 255, .96);
    box-shadow: var(--shadow-sm);
}

.stat {
    position: relative;
    display: grid;
    gap: 9px;
    min-height: 116px;
    padding: 20px;
    overflow: hidden;
    transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.stat::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
    opacity: .78;
}

.stat:hover {
    border-color: #cad5dc;
    box-shadow: var(--shadow);
    transform: translateY(-2px);
}

.stat span {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 500;
}

.stat strong {
    color: var(--text);
    font-size: 1.55rem;
    line-height: 1;
    letter-spacing: -.035em;
    font-weight: 700;
}

.card {
    padding: clamp(20px, 2.4vw, 26px);
}

.card + .card {
    margin-top: 20px;
}

.notice {
    margin-top: 20px;
}

.notice p {
    margin: 6px 0 12px;
    color: var(--muted);
    line-height: 1.55;
}

.section-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 20px;
}

.section-heading h3,
.section-heading p {
    margin: 0;
}

.section-heading h3 {
    color: var(--text);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -.018em;
}

.section-heading p {
    margin-top: 5px;
    color: var(--muted);
    font-size: .84rem;
    line-height: 1.5;
}

/* Formulários */
.field {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.field > span {
    color: var(--text-soft);
    font-size: .77rem;
    font-weight: 500;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 43px;
    padding: 0 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    outline: 0;
    color: var(--text);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
    transition: border-color var(--transition), box-shadow var(--transition), background var(--transition);
}

.field textarea {
    min-height: 110px;
    padding-block: 11px;
    resize: vertical;
}

.field input::placeholder,
.field textarea::placeholder {
    color: #9aa7b0;
}

.field input:hover,
.field select:hover,
.field textarea:hover {
    border-color: #aebbc3;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(22, 78, 99, .10);
}

.field input:disabled,
.field select:disabled,
.field textarea:disabled {
    color: #84919b;
    background: #f2f5f6;
    cursor: not-allowed;
}

.field--wide {
    grid-column: span 2;
}

.filters {
    display: grid;
    grid-template-columns: repeat(4, minmax(140px, 1fr));
    gap: 15px;
}

.filter-actions {
    grid-column: 1 / -1;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 3px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 15px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.switch-field,
.informative-check {
    display: flex;
    align-items: center;
    gap: 9px;
    color: var(--text-soft);
    font-size: .84rem;
    font-weight: 500;
}

.switch-field {
    align-self: end;
    min-height: 43px;
}

.informative-check input,
.switch-field input {
    width: 17px;
    height: 17px;
    accent-color: var(--primary);
}

.helper {
    color: var(--muted);
    font-size: .78rem;
    line-height: 1.45;
}

/* Botões */
.button {
    min-height: 41px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 0 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: .84rem;
    font-weight: 600;
    line-height: 1;
    transition: transform var(--transition), box-shadow var(--transition), background var(--transition), border-color var(--transition), color var(--transition);
}

.button:hover:not(:disabled):not(.disabled) {
    transform: translateY(-1px);
}

.button:active:not(:disabled):not(.disabled) {
    transform: translateY(0);
}

.button:disabled {
    opacity: .52;
    cursor: not-allowed;
}

.button--primary {
    color: #fff;
    background: linear-gradient(145deg, #19566b, var(--primary));
    border-color: #144759;
    box-shadow: 0 7px 16px rgba(22, 78, 99, .17);
}

.button--primary:hover {
    background: linear-gradient(145deg, var(--primary), var(--primary-2));
    box-shadow: 0 9px 20px rgba(22, 78, 99, .22);
}

.button--secondary {
    color: var(--text-soft);
    background: var(--surface);
    border-color: var(--line-strong);
    box-shadow: var(--shadow-xs);
}

.button--secondary:hover {
    color: var(--text);
    background: var(--surface-2);
    border-color: #aebbc3;
}

.button--pdf {
    color: #24443f;
    background: var(--accent-soft);
    border-color: #b8d0cb;
}

.button--pdf:hover {
    color: #fff;
    background: var(--accent-2);
    border-color: var(--accent-2);
}

.button--danger {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #ebc6c6;
}

.button--danger:hover {
    color: #fff;
    background: var(--danger);
    border-color: var(--danger);
}

.button--ghost {
    margin-top: 12px;
    color: #eef4f5;
    background: rgba(255, 255, 255, .055);
    border-color: rgba(255, 255, 255, .12);
}

.button--ghost:hover {
    background: rgba(255, 255, 255, .10);
    border-color: rgba(255, 255, 255, .18);
}

.button--small {
    min-height: 34px;
    padding: 0 10px;
    border-radius: 8px;
    font-size: .73rem;
}

.button--full {
    width: 100%;
}

.icon-button {
    width: 38px;
    height: 38px;
    display: inline-grid;
    place-items: center;
    flex: none;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text-soft);
    background: var(--surface-2);
    font-size: 1.2rem;
    transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--transition);
}

.icon-button:hover {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: #bcd0d7;
    transform: translateY(-1px);
}

/* Tabelas */
.table-card {
    margin-top: 20px;
    overflow: hidden;
}

.table-wrap {
    width: 100%;
    overflow-x: auto;
    border-radius: 0 0 var(--radius) var(--radius);
}

table {
    width: 100%;
    min-width: 760px;
    border-collapse: separate;
    border-spacing: 0;
}

th,
td {
    padding: 13px 12px;
    border-bottom: 1px solid #e6ebef;
    text-align: left;
    vertical-align: top;
    font-size: .81rem;
}

th {
    position: sticky;
    top: 0;
    z-index: 1;
    color: #5b6974;
    background: #f5f7f8;
    font-size: .69rem;
    font-weight: 600;
    letter-spacing: .065em;
    text-transform: uppercase;
}

tbody tr {
    background: #fff;
    transition: background var(--transition), box-shadow var(--transition);
}

tbody tr:hover {
    background: #f7faf9;
    box-shadow: inset 3px 0 var(--accent);
}

tbody tr:last-child td {
    border-bottom: 0;
}

.cell-primary {
    display: block;
    color: var(--text);
    font-weight: 600;
}

.cell-secondary {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: .73rem;
    line-height: 1.42;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 8px;
    border: 1px solid #cbdce1;
    border-radius: 999px;
    color: var(--primary);
    background: var(--primary-soft);
    font-size: .68rem;
    font-weight: 600;
    white-space: nowrap;
}

.badge--success {
    color: var(--success);
    background: var(--success-soft);
    border-color: #c6e0d5;
}

.badge--danger {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #edcccc;
}

.badge--warning {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: #ead9ad;
}

.row-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.empty-row {
    padding: 36px;
    color: var(--muted);
    text-align: center;
}

.pagination {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
    color: var(--muted);
    font-size: .8rem;
}

/* Layouts auxiliares */
.split-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(350px, .75fr);
    gap: 20px;
    align-items: start;
}

.editor-card {
    position: sticky;
    top: 98px;
}

.profile-card {
    max-width: 650px;
}

.profile-card h3 {
    margin: 0 0 18px;
    color: var(--text);
    font-size: 1.42rem;
    letter-spacing: -.025em;
}

dl {
    display: grid;
    gap: 0;
    margin: 0 0 22px;
}

dl > div {
    display: grid;
    grid-template-columns: 160px 1fr;
    gap: 14px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

dt {
    color: var(--muted);
}

dd {
    margin: 0;
    color: var(--text-soft);
    font-weight: 500;
}

/* Modal */
.modal {
    width: min(570px, calc(100% - 28px));
    max-height: calc(100vh - 40px);
    padding: 0;
    overflow: visible;
    border: 0;
    border-radius: var(--radius-lg);
    background: transparent;
    box-shadow: var(--shadow-lg);
}

.modal::backdrop {
    background: rgba(11, 26, 35, .64);
    backdrop-filter: blur(5px);
}

.modal--wide {
    width: min(920px, calc(100% - 28px));
}

.modal__content {
    display: grid;
    gap: 17px;
    padding: 25px;
    border: 1px solid rgba(255, 255, 255, .75);
    border-radius: var(--radius-lg);
    background: var(--surface);
}

.modal__header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding-bottom: 13px;
    border-bottom: 1px solid var(--line);
}

.modal__header h3 {
    margin: 0;
    color: var(--text);
    letter-spacing: -.02em;
}

.modal__actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 4px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
}

.alert {
    display: grid;
    gap: 4px;
    padding: 13px 14px;
    border: 1px solid transparent;
    border-radius: 11px;
    font-size: .81rem;
    line-height: 1.45;
}

.alert--info {
    color: var(--info);
    background: var(--info-soft);
    border-color: #cadde9;
}

.alert--warning {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: #ead9ad;
}

.detail-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.detail-item {
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 11px;
    background: var(--surface-2);
}

.detail-item span {
    display: block;
    color: var(--muted);
    font-size: .7rem;
    font-weight: 500;
}

.detail-item strong {
    display: block;
    margin-top: 5px;
    overflow-wrap: anywhere;
    color: var(--text-soft);
    font-size: .87rem;
    font-weight: 600;
}

.raw-text {
    max-height: 340px;
    overflow: auto;
    padding: 16px;
    border: 1px solid #cfd8de;
    border-radius: 11px;
    color: #dfe8ec;
    background: #17252d;
    font: .74rem/1.6 ui-monospace, SFMono-Regular, Consolas, monospace;
    white-space: pre-wrap;
}

/* Toasts */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    max-width: min(420px, calc(100% - 40px));
    padding: 14px 17px;
    border: 1px solid rgba(255, 255, 255, .08);
    border-radius: 12px;
    color: #fff;
    background: #21333d;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transform: translateY(-12px) scale(.98);
    pointer-events: none;
    transition: opacity var(--transition), transform var(--transition);
}

.toast.show {
    opacity: 1;
    transform: translateY(0) scale(1);
}

.toast.error {
    background: #863b3b;
}

.toast.success {
    background: #28634f;
}

/* Ações de comprovantes */
.button--link {
    color: var(--primary);
    background: var(--primary-soft);
    border-color: #bfd2d9;
}

.button--link:hover {
    color: #fff;
    background: var(--primary);
    border-color: var(--primary);
}

.row-actions--receipts {
    min-width: 278px;
    flex-wrap: nowrap;
}

.row-actions--receipts .button {
    white-space: nowrap;
}

.receipts-table {
    min-width: 1180px;
}

.receipts-table th:last-child,
.receipts-table td:last-child {
    min-width: 292px;
}

/* Versão monolítica renderizada pelo PHP */
a {
    color: inherit;
    text-decoration: none;
}

.brand {
    color: inherit;
}

.brand > span:last-child {
    min-width: 0;
    display: grid;
    gap: 3px;
}

.brand > span:last-child strong {
    font-size: 1.05rem;
}

.brand > span:last-child small {
    overflow: hidden;
    color: var(--sidebar-muted);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.topbar h1,
.topbar p,
.section-heading h2,
.section-heading p,
.profile-card h2,
.error-card h2,
.modal__header h2 {
    margin: 0;
}

.topbar h1 {
    color: var(--text);
    font-size: clamp(1.15rem, 2vw, 1.38rem);
    font-weight: 700;
    letter-spacing: -.025em;
}

.topbar__tenant {
    color: var(--muted);
    font-size: .8rem;
    font-weight: 500;
}

.menu-button {
    width: 40px;
    height: 40px;
    display: none;
    place-items: center;
    flex: none;
    padding: 0;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    color: var(--text-soft);
    background: var(--surface);
    box-shadow: var(--shadow-xs);
}

.flash {
    display: grid;
    gap: 10px;
    margin-bottom: 18px;
    padding: 14px 16px;
    border: 1px solid transparent;
    border-radius: 12px;
    font-size: .84rem;
    line-height: 1.5;
}

.flash--success {
    color: var(--success);
    background: var(--success-soft);
    border-color: #c4dfd3;
}

.flash--error {
    color: var(--danger);
    background: var(--danger-soft);
    border-color: #edcaca;
}

.flash--warning {
    color: var(--warning);
    background: var(--warning-soft);
    border-color: #ead9ad;
}

.public-link-result {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px;
    align-items: center;
}

.public-link-result input {
    min-height: 40px;
    padding: 0 11px;
    border: 1px solid #b9d0cb;
    border-radius: 9px;
    color: var(--text-soft);
    background: #fff;
}

.public-link-result input:focus {
    border-color: var(--accent);
    outline: 0;
    box-shadow: 0 0 0 4px rgba(79, 127, 120, .10);
}

.public-link-result small {
    grid-column: 1 / -1;
}

.result-count {
    color: var(--muted);
    font-size: .8rem;
}

.filters--receipts {
    grid-template-columns: repeat(5, minmax(130px, 1fr));
}

.filters--compact {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.form-page-card {
    max-width: 940px;
}

.form-grid--large {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stats-grid--five {
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.stat-status {
    font-size: 1rem !important;
    text-transform: capitalize;
}

.raw-text--small {
    min-width: 320px;
    max-height: 170px;
    margin: 0;
}

.code-inline {
    display: block;
    max-width: 420px;
    overflow-wrap: anywhere;
    white-space: normal;
    font-size: .71rem;
}

.error-card {
    max-width: 720px;
    margin: 8vh auto 0;
    padding: clamp(28px, 6vw, 54px);
    text-align: center;
}

.error-card .actions {
    justify-content: center;
    margin-top: 20px;
}

.button.disabled {
    opacity: .5;
    pointer-events: none;
}

.row-actions form {
    margin: 0;
}

.modal[open] {
    display: block;
    animation: modal-in 180ms ease both;
}

@keyframes modal-in {
    from { opacity: 0; transform: translateY(8px) scale(.985); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__content {
    max-height: calc(100vh - 40px);
    overflow: auto;
}

.badge--ted {
    color: #26725a;
    background: #e5f3ed;
    border-color: #c5dfd4;
}

.badge--pagamento_titulo {
    color: #856526;
    background: #f8f1df;
    border-color: #e8d8ad;
}

.badge--pagamento_convenio {
    color: #6b527c;
    background: #f2edf5;
    border-color: #ded2e6;
}

/* Responsividade */
@media (max-width: 1250px) {
    .filters--receipts {
        grid-template-columns: repeat(3, minmax(140px, 1fr));
    }

    .stats-grid--five {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 1120px) {
    .app {
        grid-template-columns: 230px minmax(0, 1fr);
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .filters {
        grid-template-columns: repeat(2, 1fr);
    }

    .split-layout {
        grid-template-columns: 1fr;
    }

    .editor-card {
        position: static;
    }
}

@media (max-width: 1050px) {
    .row-actions--receipts {
        min-width: 170px;
        flex-wrap: wrap;
    }
}

@media (max-width: 780px) {
    body {
        background: var(--bg);
    }

    .app {
        display: block;
    }

    .sidebar {
        position: fixed;
        z-index: 100;
        inset: 0 auto 0 0;
        width: min(292px, 86vw);
        height: 100vh;
        padding-top: 20px;
        transform: translateX(-105%);
        transition: transform 220ms cubic-bezier(.2, .8, .2, 1);
        box-shadow: 22px 0 54px rgba(8, 24, 34, .28);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .sidebar::after {
        display: none;
    }

    .nav {
        grid-template-columns: 1fr;
    }

    .sidebar__footer {
        margin-top: 18px;
    }

    .menu-button {
        display: inline-grid;
    }

    .topbar {
        min-height: 68px;
        flex-direction: row;
        align-items: center;
        padding: 12px 16px;
    }

    .topbar__tenant {
        display: none;
    }

    .topbar__actions {
        margin-left: auto;
    }

    .tenant-select {
        max-width: 160px;
    }

    .page {
        padding: 20px 15px 38px;
    }

    .hero {
        min-height: auto;
        align-items: flex-start;
        flex-direction: column;
        padding: 27px 22px;
        border-radius: 18px;
    }

    .hero h3 {
        font-size: clamp(1.42rem, 8vw, 1.92rem);
    }

    .stats-grid,
    .filters,
    .form-grid,
    .detail-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid--five {
        grid-template-columns: 1fr 1fr;
    }

    .field--wide {
        grid-column: span 1;
    }

    .filter-actions {
        grid-column: 1;
        justify-content: stretch;
    }

    .filter-actions .button {
        flex: 1;
    }

    .filters--receipts,
    .filters--compact,
    .form-grid--large {
        grid-template-columns: 1fr;
    }

    .public-link-result {
        grid-template-columns: 1fr;
    }

    .public-link-result small {
        grid-column: 1;
    }

    .section-heading {
        flex-direction: column;
    }

    .card {
        padding: 19px;
        border-radius: 14px;
    }

    dl > div {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .modal__content {
        padding: 20px;
    }
}

@media (max-width: 520px) {
    .topbar__actions .status,
    .topbar__actions .tenant-select {
        display: none;
    }

    .stats-grid--five {
        grid-template-columns: 1fr;
    }

    .filter-actions,
    .form-actions,
    .modal__actions {
        flex-direction: column-reverse;
    }

    .filter-actions .button,
    .form-actions .button,
    .modal__actions .button {
        width: 100%;
    }

    .row-actions--receipts {
        min-width: 150px;
    }
}

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

/* =========================================================
   Tela de login — Portal Comprovante
   ========================================================= */
.login-body {
    position: relative;
    min-height: 100vh;
    overflow-x: hidden;
    background:
        radial-gradient(circle at 12% 8%, rgba(79, 127, 120, .16), transparent 28rem),
        radial-gradient(circle at 95% 95%, rgba(22, 78, 99, .12), transparent 32rem),
        #edf2f3;
}

.login-body::before,
.login-body::after {
    content: "";
    position: fixed;
    z-index: 0;
    border-radius: 999px;
    pointer-events: none;
    filter: blur(2px);
}

.login-body::before {
    top: -190px;
    right: -140px;
    width: 430px;
    height: 430px;
    border: 1px solid rgba(22, 78, 99, .10);
    background: rgba(255, 255, 255, .20);
}

.login-body::after {
    bottom: -230px;
    left: -190px;
    width: 520px;
    height: 520px;
    border: 1px solid rgba(79, 127, 120, .10);
    background: rgba(255, 255, 255, .16);
}

.login-body .login-shell {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    padding: 0;
}

.login-layout {
    width: 100vw;
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(390px, .92fr);
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: rgba(255, 255, 255, .84);
    box-shadow: none;
    backdrop-filter: blur(24px);
}

.login-showcase {
    position: relative;
    isolation: isolate;
    display: flex;
    flex-direction: column;
    min-height: 100%;
    padding: clamp(34px, 5vw, 58px);
    overflow: hidden;
    color: #f7fbfb;
    background:
        linear-gradient(145deg, rgba(18, 56, 70, .98), rgba(20, 78, 91, .95) 54%, rgba(61, 105, 100, .95));
}

.login-showcase::before {
    content: "";
    position: absolute;
    z-index: -1;
    top: -170px;
    right: -140px;
    width: 420px;
    height: 420px;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 50%;
    box-shadow:
        0 0 0 48px rgba(255, 255, 255, .025),
        0 0 0 96px rgba(255, 255, 255, .018);
}

.login-showcase::after {
    content: "";
    position: absolute;
    z-index: -1;
    inset: auto -20% -42% 18%;
    height: 420px;
    transform: rotate(-8deg);
    border-radius: 50%;
    background: linear-gradient(180deg, rgba(255,255,255,.08), transparent 70%);
}

.login-brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    color: #fff;
}

.login-brand__mark {
    width: 48px;
    height: 48px;
    display: grid;
    place-items: center;
    flex: none;
    border: 1px solid rgba(255, 255, 255, .20);
    border-radius: 15px;
    background: rgba(255, 255, 255, .11);
    box-shadow: inset 0 1px rgba(255,255,255,.12), 0 12px 32px rgba(4, 25, 33, .18);
    font-weight: 800;
    letter-spacing: -.06em;
}

.login-brand strong,
.login-brand small {
    display: block;
}

.login-brand strong {
    font-size: 1rem;
    letter-spacing: -.01em;
    font-weight: 700;
}

.login-brand small {
    margin-top: 3px;
    color: rgba(255, 255, 255, .68);
    font-size: .76rem;
}

.login-showcase__content {
    max-width: 520px;
    margin: auto 0;
    padding: 70px 0 54px;
}

.login-showcase__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    padding: 7px 11px;
    border: 1px solid rgba(255,255,255,.14);
    border-radius: 999px;
    color: rgba(255,255,255,.84);
    background: rgba(255,255,255,.07);
    font-size: .69rem;
    font-weight: 600;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.login-showcase__eyebrow::before {
    content: "";
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #9ec9bd;
    box-shadow: 0 0 0 5px rgba(158, 201, 189, .10);
}

.login-showcase h2 {
    max-width: 520px;
    margin: 0;
    font-size: clamp(2rem, 4vw, 3.25rem);
    line-height: 1.04;
    letter-spacing: -.052em;
}

.login-showcase__description {
    max-width: 485px;
    margin: 22px 0 0;
    color: rgba(243, 250, 250, .72);
    font-size: .98rem;
    line-height: 1.75;
}

.login-benefits {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin: 30px 0 0;
    padding: 0;
    list-style: none;
}

.login-benefits li {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 12px 13px;
    border: 1px solid rgba(255,255,255,.10);
    border-radius: 13px;
    color: rgba(255,255,255,.82);
    background: rgba(255,255,255,.055);
    font-size: .78rem;
    font-weight: 500;
}

.login-benefits svg {
    width: 17px;
    height: 17px;
    flex: none;
    color: #a9d4c7;
}

.login-showcase__footer {
    color: rgba(255,255,255,.52);
    font-size: .73rem;
}

.login-body .login-card {
    position: relative;
    width: auto;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(34px, 5vw, 62px);
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: rgba(255, 255, 255, .96);
    box-shadow: none;
    backdrop-filter: none;
}

.login-body .login-card::before {
    display: none;
}

.login-card__mobile-brand {
    display: none;
    align-items: center;
    gap: 11px;
    margin-bottom: 32px;
}

.login-card__mobile-brand .brand__mark {
    width: 43px;
    height: 43px;
    border-radius: 13px;
}

.login-card__mobile-brand strong,
.login-card__mobile-brand small {
    display: block;
}

.login-card__mobile-brand strong {
    font-size: .94rem;
    font-weight: 600;
}

.login-card__mobile-brand small {
    margin-top: 2px;
    color: var(--muted);
    font-size: .72rem;
}

.login-card__header {
    margin-bottom: 28px;
}

.login-card__header .eyebrow {
    margin-bottom: 10px;
}

.login-card__header h1 {
    margin: 0;
    color: var(--text);
    font-size: clamp(1.75rem, 3vw, 2.25rem);
    line-height: 1.12;
    letter-spacing: -.04em;
}

.login-card__header p {
    margin: 11px 0 0;
    color: var(--muted);
    font-size: .9rem;
    line-height: 1.6;
}

.login-body .form-stack {
    gap: 18px;
}

.login-body .field {
    gap: 8px;
}

.login-body .field > span {
    color: var(--text-soft);
    font-size: .76rem;
    font-weight: 500;
    letter-spacing: .01em;
}

.input-control {
    position: relative;
}

.input-control > svg {
    position: absolute;
    top: 50%;
    left: 14px;
    width: 18px;
    height: 18px;
    transform: translateY(-50%);
    color: #82909b;
    pointer-events: none;
    transition: color var(--transition);
}

.login-body .input-control input {
    min-height: 50px;
    padding: 0 46px 0 44px;
    border-color: #d4dde2;
    border-radius: 12px;
    background: #fbfcfc;
    box-shadow: inset 0 1px 2px rgba(19, 39, 48, .025);
}

.login-body .input-control input:hover {
    border-color: #b7c5cc;
    background: #fff;
}

.login-body .input-control input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 4px rgba(22, 78, 99, .10);
}

.input-control:focus-within > svg {
    color: var(--primary);
}

.password-toggle {
    position: absolute;
    top: 50%;
    right: 8px;
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 9px;
    color: #74838e;
    background: transparent;
    transition: color var(--transition), background var(--transition);
}

.password-toggle:hover {
    color: var(--primary);
    background: var(--primary-soft);
}

.password-toggle svg {
    width: 18px;
    height: 18px;
}

.login-body .button--primary {
    min-height: 50px;
    margin-top: 2px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--primary), #1d6473);
    box-shadow: 0 12px 28px rgba(22, 78, 99, .20);
}

.login-body .button--primary:hover:not(:disabled) {
    background: linear-gradient(135deg, var(--primary-2), #195968);
    box-shadow: 0 16px 32px rgba(22, 78, 99, .25);
}

.login-security {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    margin: 17px 0 0;
    color: var(--muted);
    font-size: .72rem;
}

.login-security svg {
    width: 14px;
    height: 14px;
    color: var(--accent-2);
}

.login-credit {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 34px;
    padding-top: 22px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: .74rem;
    text-align: center;
}

.login-credit strong {
    color: var(--text-soft);
    font-weight: 500;
}

.login-credit__separator {
    color: #b3bec5;
}

.login-credit__whatsapp {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    color: #27735d;
    font-weight: 600;
    transition: color var(--transition), transform var(--transition);
}

.login-credit__whatsapp:hover {
    color: #175b47;
    transform: translateY(-1px);
}

.login-credit__whatsapp svg {
    width: 15px;
    height: 15px;
}

.login-body .flash {
    margin-top: -6px;
    margin-bottom: 22px;
}

@media (max-width: 900px) {
    .login-layout {
        width: 100vw;
        min-height: 100vh;
        grid-template-columns: 1fr;
        border-radius: 0;
    }

    .login-showcase {
        display: none;
    }

    .login-body .login-card {
        min-height: 100vh;
        padding: clamp(28px, 7vw, 48px);
    }

    .login-card__mobile-brand {
        display: flex;
    }
}

@media (max-width: 520px) {
    .login-body .login-shell {
        align-items: stretch;
        padding: 0;
    }

    .login-layout {
        width: 100%;
        min-height: 100vh;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .login-body .login-card {
        min-height: 100vh;
        justify-content: center;
        padding: 30px 22px;
    }

    .login-card__mobile-brand {
        margin-bottom: 38px;
    }

    .login-card__header {
        margin-bottom: 25px;
    }

    .login-card__header h1 {
        font-size: 1.78rem;
    }

    .login-credit {
        margin-top: 28px;
    }
}
