:root {
    color-scheme: light;
    --bg: #f4f7f9;
    --panel: #ffffff;
    --line: #d9e2e7;
    --text: #172026;
    --muted: #63717b;
    --brand: #126c79;
    --brand-dark: #0c4d58;
    --ok: #16835a;
    --warn: #ad6b00;
    --bad: #b42318;
    --shadow: 0 16px 40px rgba(28, 46, 55, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
    letter-spacing: 0;
}

h1,
h2,
p {
    margin: 0;
}

h1 {
    font-size: 28px;
    line-height: 1.2;
}

h2 {
    font-size: 17px;
}

.login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(18, 108, 121, 0.12), rgba(49, 209, 144, 0.08)),
        var(--bg);
}

.maintenance-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
    background:
        linear-gradient(135deg, rgba(18, 108, 121, 0.12), rgba(173, 107, 0, 0.08)),
        var(--bg);
}

.login-card {
    width: min(100%, 380px);
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.maintenance-card {
    display: grid;
    gap: 24px;
    width: min(100%, 560px);
    padding: 30px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
}

.login-brand {
    margin-bottom: 24px;
    color: var(--text);
}

.maintenance-brand {
    margin-bottom: 0;
    color: var(--text);
}

.login-brand span {
    color: var(--muted);
}

.maintenance-brand span {
    color: var(--muted);
}

.maintenance-content {
    display: grid;
    gap: 12px;
}

.maintenance-kicker {
    color: var(--brand);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.maintenance-content h1 {
    color: var(--text);
    font-size: clamp(30px, 5vw, 46px);
    line-height: 1.02;
}

.maintenance-content p:last-child {
    max-width: 48ch;
    color: var(--muted);
    font-size: 16px;
    line-height: 1.55;
}

.maintenance-status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    width: fit-content;
    padding: 9px 12px;
    border: 1px solid #c5d6dc;
    border-radius: 8px;
    background: #f6fbfc;
    color: var(--text);
}

.maintenance-pulse {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: var(--warn);
    box-shadow: 0 0 0 0 rgba(173, 107, 0, 0.55);
    animation: maintenance-pulse 1.4s infinite;
}

@keyframes maintenance-pulse {
    70% {
        box-shadow: 0 0 0 9px rgba(173, 107, 0, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(173, 107, 0, 0);
    }
}

.login-form {
    display: grid;
    gap: 14px;
}

.login-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.login-form input {
    width: 100%;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    color: var(--text);
    font: inherit;
}

.login-button {
    width: 100%;
}

.login-message {
    min-height: 18px;
    color: var(--bad);
    font-size: 13px;
}

.shell {
    display: grid;
    grid-template-columns: 272px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    gap: 28px;
    height: 100vh;
    padding: 24px;
    background: #10252d;
    color: #eef7f8;
    overflow: auto;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    background: #d7f2ed;
    color: #0f4f58;
    font-weight: 800;
}

.brand strong,
.brand span,
.side-status strong,
.side-status span {
    display: block;
}

.brand span,
.side-status span {
    margin-top: 2px;
    color: #b9ced2;
    font-size: 13px;
}

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

button {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--brand-dark);
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(28, 46, 55, 0.06);
    font: inherit;
}

button:hover {
    border-color: #9db6bf;
}

button:disabled {
    cursor: wait;
    opacity: 0.72;
}

.nav button {
    display: block;
    width: 100%;
    height: auto;
    padding: 11px 12px;
    border: 0;
    background: transparent;
    color: #c9dcdf;
    box-shadow: none;
    font-size: 14px;
    text-align: left;
}

.nav button.active,
.nav button:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #ffffff;
}

.side-status {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: auto;
    padding: 14px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 8px;
}

.monitor-status {
    margin-top: 0;
}

.side-status small {
    display: block;
    max-width: 190px;
    margin-top: 4px;
    overflow-wrap: anywhere;
    color: #93adb3;
    font-size: 12px;
}

.pulse {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #31d190;
    box-shadow: 0 0 0 6px rgba(49, 209, 144, 0.15);
    flex: 0 0 auto;
}

.pulse.warn {
    background: #e0a22b;
    box-shadow: 0 0 0 6px rgba(224, 162, 43, 0.15);
}

.pulse.off {
    background: #7f949a;
    box-shadow: 0 0 0 6px rgba(127, 148, 154, 0.13);
}

.pulse.bad {
    background: #e04f43;
    box-shadow: 0 0 0 6px rgba(224, 79, 67, 0.15);
}

.main {
    min-width: 0;
    padding: 26px;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.topbar > div {
    min-width: 0;
}

.topbar-title {
    flex: 1 1 280px;
}

.topbar h1,
.topbar p,
.panel-head h2,
.panel-head p {
    overflow-wrap: anywhere;
}

.topbar p,
.panel-head p {
    margin-top: 4px;
    color: var(--muted);
}

.toolbar {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 10px;
}

.top-company-selector {
    display: flex;
    flex: 1 1 560px;
    align-items: stretch;
    gap: 12px;
    width: clamp(460px, 46vw, 760px);
    min-width: min(420px, 100%);
    max-width: 760px;
    min-height: 72px;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    box-shadow: 0 6px 16px rgba(28, 46, 55, 0.06);
}

.top-company-selector[hidden] {
    display: none;
}

.top-company-selector span {
    flex: 0 0 auto;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.top-company-all {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 72px;
}

.top-company-all input {
    width: 16px;
    height: 16px;
    accent-color: var(--accent);
}

.top-company-picker {
    display: grid;
    flex: 1 1 auto;
    gap: 4px;
    min-width: 0;
}

.top-company-selector select {
    min-width: 0;
    width: 100%;
    min-height: 48px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #f8fafb;
    color: var(--text);
    font: inherit;
    font-size: 12px;
    font-weight: 700;
    outline: none;
}

.top-company-selector option {
    padding: 4px 6px;
}

.company-filter-field {
    display: none !important;
}

.mobile-menu-button {
    display: none;
    flex: 0 0 auto;
}

.mobile-menu-button .menu-label {
    display: none;
    font-size: 13px;
    font-weight: 800;
}

.mobile-backdrop {
    position: fixed;
    inset: 0;
    z-index: 29;
    background: rgba(15, 32, 38, 0.42);
}

body.audit-fullscreen .shell {
    grid-template-columns: minmax(0, 1fr);
}

body.audit-fullscreen .sidebar {
    display: none;
}

body.audit-fullscreen .metrics {
    display: none;
}

body.audit-fullscreen .mobile-menu-button {
    display: inline-flex;
    width: auto;
    min-width: 118px;
    height: 42px;
    padding: 0 12px;
    box-shadow: none;
}

body.audit-fullscreen .mobile-menu-button .menu-icon {
    display: none;
}

body.audit-fullscreen .mobile-menu-button .menu-label {
    display: inline;
}

@media (max-width: 1120px) {
    body.audit-fullscreen .topbar {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    body.audit-fullscreen .topbar-title {
        flex: 1 1 min(100%, 420px);
    }

    body.audit-fullscreen .top-company-selector {
        order: 3;
        flex: 1 1 280px;
        width: auto;
        max-width: none;
    }

    body.audit-fullscreen .toolbar {
        order: 4;
        margin-left: auto;
    }
}

@media (max-width: 760px) {
    body.audit-fullscreen .mobile-menu-button {
        display: inline-flex;
    }
}

.user-chip {
    display: inline-flex;
    align-items: center;
    min-height: 36px;
    padding: 0 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.icon {
    font-size: 22px;
    line-height: 1;
}

.metrics {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(176px, 1fr));
    gap: 14px;
    margin-bottom: 14px;
}

.metrics article,
.panel {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    box-shadow: var(--shadow);
}

.metrics article {
    display: grid;
    align-content: space-between;
    min-width: 0;
    min-height: 96px;
    padding: 18px;
}

.metrics span {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.25;
}

.metrics strong {
    display: block;
    margin-top: 8px;
    min-width: 0;
    overflow-wrap: anywhere;
    font-size: 26px;
    line-height: 1;
}

.content-grid {
    display: grid;
    grid-template-columns: minmax(360px, 0.95fr) minmax(0, 1.05fr);
    gap: 14px;
    align-items: start;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
}

.panel {
    min-width: 0;
    overflow: hidden;
}

.panel-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 18px;
    border-bottom: 1px solid var(--line);
}

.panel-head > div {
    min-width: 0;
}

.dashboard-risk-panel .panel-head {
    align-items: flex-start;
}

.dashboard-period-form {
    display: grid;
    grid-template-columns: minmax(90px, 112px) repeat(2, minmax(118px, 142px)) minmax(200px, 260px) minmax(130px, 150px) minmax(260px, auto);
    gap: 8px;
    align-items: end;
    min-width: 0;
}

.dashboard-period-form label {
    display: grid;
    gap: 4px;
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.dashboard-period-form input,
.dashboard-period-form select {
    width: 100%;
    min-width: 0;
    border: 1px solid var(--line);
    border-radius: 7px;
    padding: 6px 8px;
    color: var(--text);
    font: inherit;
}

.dashboard-period-form input {
    height: 34px;
}

.dashboard-period-form select {
    min-height: 58px;
    background: #ffffff;
}

.dashboard-cfop-field {
    align-self: stretch;
}

.dashboard-venda-cfop-check {
    align-self: end;
    justify-content: center;
    white-space: nowrap;
}

.dashboard-period-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    min-width: 0;
}

.dashboard-period-actions .command {
    width: auto;
    min-width: 58px;
    height: 34px;
    padding: 6px 10px;
    white-space: nowrap;
}

.view {
    display: none;
}

.view.active {
    display: block;
}

.list {
    display: grid;
    gap: 10px;
    padding: 18px;
}

.dashboard-list {
    gap: 6px;
    padding: 10px 12px 12px;
}

.dashboard-list-footer {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    padding: 12px 8px 2px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.dashboard-list-footer .command {
    width: auto;
    min-width: 132px;
}

.dashboard-list-footer strong {
    color: var(--ok);
    font-size: 12px;
}

.dashboard-risk {
    display: grid;
    gap: 12px;
    padding: 14px 18px 18px;
}

.dashboard-risk-source {
    width: fit-content;
    max-width: 100%;
    padding: 6px 9px;
    border: 1px solid #bfd3d9;
    border-radius: 6px;
    background: #f7fbfc;
    color: #37505a;
    font-size: 12px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.dashboard-risk-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 8px;
}

.dashboard-risk-card {
    display: grid;
    align-content: start;
    gap: 6px;
    min-width: 0;
    min-height: 108px;
    padding: 12px;
    border: 1px solid #c7d7de;
    border-left: 4px solid var(--brand);
    border-radius: 8px;
    background: #fbfdfe;
}

.dashboard-risk-card.bad {
    border-left-color: var(--bad);
    background: #fff8f7;
}

.dashboard-risk-card.warn {
    border-left-color: var(--warn);
    background: #fffaf1;
}

.dashboard-risk-card.ok {
    border-left-color: var(--ok);
    background: #f5fbf8;
}

.dashboard-risk-card span,
.dashboard-risk-card small,
.dashboard-risk-tax span,
.dashboard-risk-tax small,
.dashboard-risk-event span,
.dashboard-risk-event small,
.dashboard-risk-technical-item span,
.dashboard-risk-technical-item small {
    min-width: 0;
    color: var(--muted);
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.dashboard-risk-card span {
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.dashboard-risk-card strong {
    min-width: 0;
    color: var(--text);
    font-size: 22px;
    line-height: 1.05;
    overflow-wrap: anywhere;
}

.dashboard-risk-card small {
    font-size: 11px;
}

.dashboard-risk-body {
    display: grid;
    grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.1fr);
    gap: 10px;
    align-items: start;
}

.dashboard-risk-block,
.dashboard-risk-technical,
.dashboard-risk-explanation {
    display: grid;
    gap: 8px;
    min-width: 0;
    padding: 12px;
    border: 1px solid #d3e0e5;
    border-radius: 8px;
    background: #ffffff;
}

.dashboard-risk-block-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    min-width: 0;
}

.dashboard-risk-block-head strong,
.dashboard-risk-explanation strong {
    min-width: 0;
    color: var(--text);
    font-size: 14px;
    overflow-wrap: anywhere;
}

.dashboard-risk-block-head span {
    min-width: 0;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    overflow-wrap: anywhere;
    text-align: right;
}

.dashboard-risk-tax-list,
.dashboard-risk-events,
.dashboard-risk-technical-list {
    display: grid;
    gap: 7px;
    min-width: 0;
}

.dashboard-risk-tax,
.dashboard-risk-event,
.dashboard-risk-technical-item {
    min-width: 0;
    border: 1px solid #d8e3e8;
    border-radius: 8px;
    background: #fbfcfd;
}

.dashboard-risk-tax {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 4px 10px;
    padding: 9px 10px;
}

.dashboard-risk-tax > div {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.dashboard-risk-tax strong,
.dashboard-risk-event strong,
.dashboard-risk-technical-item strong {
    min-width: 0;
    color: var(--text);
    font-size: 13px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.dashboard-risk-tax b {
    color: var(--text);
    font-size: 13px;
    text-align: right;
    white-space: nowrap;
}

.dashboard-risk-tax small {
    grid-column: 1 / -1;
    font-size: 11px;
}

.dashboard-risk-event {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(132px, auto);
    gap: 10px;
    padding: 9px 10px;
    border-left: 4px solid var(--bad);
}

.dashboard-risk-event.over {
    border-left-color: var(--warn);
}

.dashboard-risk-event[role="button"] {
    cursor: pointer;
}

.dashboard-risk-event[role="button"]:hover,
.dashboard-risk-event[role="button"]:focus-visible {
    border-color: #9db6bf;
    box-shadow: 0 8px 18px rgba(28, 46, 55, 0.08);
    outline: none;
}

.dashboard-risk-event-main,
.dashboard-risk-event-values,
.dashboard-risk-technical-item {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.dashboard-risk-event-values {
    align-content: start;
    text-align: right;
}

.dashboard-risk-event-values b {
    color: var(--text);
    font-size: 12px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.dashboard-risk-event-values span,
.dashboard-risk-event small,
.dashboard-risk-technical-item small {
    font-size: 11px;
}

.dashboard-risk-technical {
    border-left: 4px solid var(--warn);
    background: #fffdf8;
}

.dashboard-risk-technical-item {
    padding: 8px 10px;
}

.dashboard-risk-explanation {
    border-left: 4px solid var(--brand);
    background: #f7fbfc;
}

.dashboard-risk-explanation p {
    color: #3d4c53;
    font-size: 13px;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.dashboard-risk-empty {
    padding: 12px;
    border: 1px dashed #c7d7de;
    border-radius: 8px;
    background: #fbfcfd;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.list.empty,
.empty {
    color: var(--muted);
}

.item {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px 12px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.compact-note {
    display: grid;
    grid-template-columns: minmax(64px, 0.46fr) minmax(58px, 0.36fr) minmax(130px, 1.2fr) minmax(68px, 0.48fr) minmax(78px, 0.5fr) minmax(220px, 1.7fr) minmax(100px, 0.54fr);
    gap: 10px;
    align-items: center;
    min-height: 32px;
    padding: 7px 10px;
    border: 1px solid #c1d0d7;
    border-radius: 8px;
    background: #fbfdfe;
}

.compact-note:not(.compact-note-head) {
    container: compact-note / inline-size;
    row-gap: 6px;
    box-shadow: 0 6px 16px rgba(28, 46, 55, 0.08);
}

.compact-note:not(.compact-note-head):hover {
    border-color: #8fb6c0;
    background: #ffffff;
}

.compact-note strong,
.compact-note span,
.compact-note code,
.compact-note a,
.tax-pill b {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    line-height: 1.22;
    overflow-wrap: anywhere;
}

.compact-note strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

.compact-note span,
.compact-note code,
.compact-note a {
    color: var(--muted);
}

.compact-note code {
    font-family: Consolas, "Courier New", monospace;
    white-space: nowrap;
}

.compact-emitter {
    color: #2b3940 !important;
    font-weight: 700;
}

.compact-money {
    color: var(--text) !important;
    font-weight: 800;
    text-align: right;
}

.compact-note-head {
    min-height: 28px;
    border-color: #c9d6dc;
    background: linear-gradient(180deg, #f7fafb 0%, #edf4f6 100%);
    font-weight: 800;
}

.compact-note-head span {
    color: #37505a;
    font-size: 11px;
    text-transform: uppercase;
}

.tax-strip {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.service-strip {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(112px, 0.7fr) minmax(280px, 2fr) repeat(2, minmax(150px, 1fr));
    gap: 6px;
}

.dashboard-audit-strip {
    grid-column: 1 / -1;
    display: grid;
    gap: 6px;
}

.dashboard-audit-summary {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.dashboard-audit-summary > span:not(.compact-divergence) {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 7px;
    border: 1px solid #c8d8df;
    border-radius: 4px;
    background: #f7fbfc;
    color: #37505a;
    font-size: 11px;
    font-weight: 800;
}

.dashboard-audit-checks {
    width: 100%;
}

.dashboard-audit-items {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 6px;
    width: 100%;
}

.dashboard-audit-item {
    display: grid;
    gap: 5px;
    min-width: 0;
    padding: 7px 8px;
    border-left: 3px solid #126c79;
    background: #f7fbfc;
}

.dashboard-audit-item-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 6px;
    align-items: center;
    min-width: 0;
    color: #37505a;
    font-size: 11px;
}

.dashboard-audit-item-head strong,
.dashboard-audit-item-head span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dashboard-audit-strip .report-check {
    overflow: visible;
    text-overflow: clip;
}

.service-pill {
    display: grid;
    gap: 2px;
    min-width: 0;
    min-height: 46px;
    padding: 7px 9px;
    border: 1px solid #bfd3d9;
    border-left: 3px solid #126c79;
    border-radius: 8px;
    background: #f7fbfc;
}

.service-pill span,
.service-pill b,
.service-pill small,
.retention-badge {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.service-pill span,
.service-pill small {
    color: #586970;
    font-size: 10.5px;
}

.service-pill b {
    color: #1f2d33;
    font-size: 11px;
    font-weight: 800;
    white-space: nowrap;
}

.service-main b {
    white-space: normal;
}

.service-status {
    border-left-color: #6b4aa0;
}

.service-retained {
    border-color: #e0aaa5;
    border-left-color: var(--bad);
    background: #fff7f6;
}

.retention-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-height: 18px;
    padding: 2px 7px;
    border: 1px solid #e0aaa5;
    border-radius: 999px;
    background: #ffe7e4;
    color: var(--bad);
    font-size: 10px;
    font-style: normal;
    font-weight: 900;
    line-height: 1;
}

.tax-pill {
    --tax-color: var(--brand);
    display: grid;
    grid-template-columns: minmax(64px, 0.76fr) minmax(58px, 0.66fr) minmax(74px, 0.92fr) minmax(38px, 0.42fr) minmax(66px, 0.82fr);
    align-items: center;
    gap: 6px;
    width: 100%;
    min-width: 0;
    min-height: 23px;
    padding: 3px 8px 3px 6px;
    border: 1px solid color-mix(in srgb, var(--tax-color) 30%, #d9e2e7);
    border-left: 4px solid var(--tax-color);
    border-radius: 7px;
    background: color-mix(in srgb, var(--tax-color) 7%, #ffffff);
    color: #40525a;
}

.tax-pill strong {
    color: var(--tax-color);
    font-size: 11px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tax-pill span,
.tax-pill b {
    font-size: 10.5px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    overflow-wrap: anywhere;
    white-space: nowrap;
}

.tax-pill span {
    color: #586970;
}

.tax-pill b {
    color: #1f2d33;
    font-weight: 800;
    text-align: right;
}

.tax-cst {
    font-weight: 700;
}

.tax-rate {
    text-align: center;
}

.tax-ibs,
.tax-cbs {
    grid-template-columns: minmax(38px, 0.4fr) minmax(112px, 1.05fr) minmax(64px, 0.68fr) minmax(34px, 0.34fr) minmax(58px, 0.6fr);
}

.tax-ibs .tax-cst,
.tax-cbs .tax-cst {
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
}

@container compact-note (max-width: 1120px) {
    .tax-strip {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .tax-pill {
        grid-template-columns: minmax(54px, 0.8fr) minmax(58px, 0.8fr) minmax(0, 1fr);
        min-height: 43px;
        row-gap: 3px;
    }

    .tax-ibs,
    .tax-cbs {
        grid-template-columns: minmax(34px, 0.34fr) minmax(112px, 1.12fr) minmax(0, 1fr);
    }

    .tax-pill strong {
        grid-column: 1;
        grid-row: 1;
    }

    .tax-cst {
        grid-column: 2;
        grid-row: 1;
    }

    .tax-value {
        grid-column: 3;
        grid-row: 1;
    }

    .tax-base {
        grid-column: 1 / span 2;
        grid-row: 2;
    }

    .tax-rate {
        grid-column: 3;
        grid-row: 2;
        text-align: right;
    }
}

@container compact-note (max-width: 860px) {
    .tax-strip {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@container compact-note (max-width: 640px) {
    .tax-strip {
        grid-template-columns: 1fr;
    }

    .tax-pill {
        grid-template-columns: minmax(58px, 0.62fr) minmax(0, 1fr);
        min-height: 54px;
        padding-block: 5px;
    }

    .tax-ibs,
    .tax-cbs {
        min-height: 74px;
    }

    .tax-pill strong {
        grid-column: 1;
        grid-row: 1;
    }

    .tax-value {
        grid-column: 2;
        grid-row: 1;
    }

    .tax-cst {
        grid-column: 1;
        grid-row: 2;
    }

    .tax-base {
        grid-column: 2;
        grid-row: 2;
    }

    .tax-rate {
        grid-column: 1 / -1;
        grid-row: 3;
        text-align: left;
    }

    .tax-ibs .tax-cst,
    .tax-cbs .tax-cst {
        grid-column: 1 / -1;
        grid-row: 2;
    }

    .tax-ibs .tax-base,
    .tax-cbs .tax-base {
        grid-column: 1 / -1;
        grid-row: 3;
    }

    .tax-ibs .tax-rate,
    .tax-cbs .tax-rate {
        grid-column: 1 / -1;
        grid-row: 4;
    }
}

.tax-icms {
    --tax-color: #126c79;
}

.tax-ipi {
    --tax-color: #9a5c00;
}

.tax-pis {
    --tax-color: #315f9f;
}

.tax-cofins {
    --tax-color: #8b3f69;
}

.tax-ibs {
    --tax-color: #4d6b1f;
}

.tax-cbs {
    --tax-color: #6b4aa0;
}

.compact-file-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
}

.note-link,
.xml-link,
.pdf-link,
.cce-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    min-width: 40px;
    min-height: 23px;
    padding: 2px 7px;
    border: 1px solid #8fb6c0;
    border-radius: 8px;
    background: #f8fcfd;
    color: var(--brand) !important;
    font-size: 10px;
    font-weight: 800;
    text-decoration: none;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.88), 0 4px 10px rgba(18, 108, 121, 0.08);
}

.xml-link {
    border-color: #b8c9ba;
    background: #f8fbf7;
    color: #2f6f46 !important;
}

.cce-link {
    min-width: 38px;
    border-color: #d5bd76;
    background: #fffaf0;
    color: #7a5900 !important;
}

.note-link:hover,
.xml-link:hover,
.pdf-link:hover,
.cce-link:hover {
    border-color: var(--brand);
    background: var(--brand);
    color: #ffffff !important;
}

.compact-divergence {
    display: inline-flex !important;
    align-items: center;
    width: fit-content;
    max-width: 100%;
    min-height: 24px;
    padding: 3px 8px;
    border-radius: 999px;
    font-weight: 700;
}

.compact-divergence.ok {
    background: #dff5eb;
    color: var(--ok);
}

.compact-divergence.warn {
    background: #fff1d6;
    color: var(--warn);
}

.compact-divergence.bad {
    background: #ffe7e3;
    color: var(--bad);
}

.item-main {
    min-width: 0;
}

.item strong,
.item span,
.item code {
    display: block;
}

.item strong {
    overflow-wrap: anywhere;
    font-size: 14px;
}

.item span,
.item code {
    margin-top: 5px;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 12px;
}

.item code {
    font-family: Consolas, "Courier New", monospace;
}

.item-grid {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
    margin-top: 6px;
}

.info {
    min-width: 0;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.info span {
    display: block;
    margin-top: 0;
    color: var(--muted);
    font-size: 12px;
}

.info strong {
    display: block;
    margin-top: 4px;
    overflow-wrap: anywhere;
    color: var(--text);
    line-height: 1.25;
}

.info.ok {
    border-color: #9bd9c1;
    border-left: 4px solid var(--ok);
    background: #f0fbf6;
}

.info.warn {
    border-color: #efcf93;
    border-left: 4px solid var(--warn);
    background: #fff8ea;
}

.info.bad {
    border-color: #f0b5ad;
    border-left: 4px solid var(--bad);
    background: #fff4f2;
}

.info.accent {
    border-color: #a8ced6;
    border-left: 4px solid var(--brand);
    background: #f0fafb;
}

.info.muted,
.info.path {
    background: #f8fafb;
}

.info.ok strong {
    color: var(--ok);
}

.info.warn strong {
    color: var(--warn);
}

.info.bad strong {
    color: var(--bad);
}

.info.accent strong {
    color: var(--brand-dark);
}

.audit-parameter-values {
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
    gap: 6px;
    margin-top: 4px;
}

.audit-parameter-values .info {
    min-height: 48px;
    padding: 7px 9px;
}

.audit-parameter-values .info span {
    font-size: 11px;
    line-height: 1.15;
}

.audit-parameter-values .info strong {
    margin-top: 3px;
    font-size: 13px;
    line-height: 1.18;
}

.audit-tags-panel {
    padding-top: 4px;
    border-top: 1px solid var(--line);
}

.audit-tax-tags-list {
    padding-top: 10px;
}

.audit-tax-tag-values {
    grid-template-columns: repeat(auto-fit, minmax(88px, 1fr));
    gap: 6px;
}

.audit-tax-tag-option {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 8px;
    align-items: start;
    min-height: 54px;
    padding: 8px 9px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.audit-tax-tag-option input {
    margin-top: 3px;
}

.audit-tax-tag-option span {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.audit-tax-tag-option strong,
.audit-tax-tag-option small,
.audit-tax-tag-option code {
    overflow-wrap: anywhere;
}

.audit-tax-tag-option strong {
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
}

.audit-tax-tag-option small {
    color: var(--muted);
    font-size: 11px;
    line-height: 1.2;
}

.audit-tax-tag-option code {
    color: var(--muted);
    font-size: 10px;
}

.audit-tags-actions {
    justify-content: flex-end;
    padding: 8px 0 0;
}

.audit-tags-actions[hidden] {
    display: none;
}

.audit-saved-tags-panel {
    display: grid;
    gap: 8px;
    margin-top: 10px;
    padding: 10px 12px;
    border: 1px solid #efb8b8;
    border-radius: 8px;
    background: #fff1f1;
}

.audit-saved-tags-panel[hidden] {
    display: none;
}

.audit-saved-tags-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.audit-saved-tags-head strong,
.audit-saved-tags-head span,
.audit-saved-tags-panel > small {
    color: #a13b3b;
}

.audit-saved-tags-head strong {
    font-size: 14px;
}

.audit-saved-tags-head span {
    font-size: 12px;
    font-weight: 800;
}

.audit-saved-tags-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.audit-saved-tags-list code {
    max-width: 100%;
    padding: 5px 7px;
    border: 1px solid #e6b2b2;
    border-radius: 7px;
    background: #fffafa;
    color: #8f3131;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    overflow-wrap: anywhere;
}

.audit-saved-tags-list small {
    color: #8f3131;
    font-size: 12px;
}

.audit-dynamic-fields {
    display: grid;
    gap: 10px;
    padding: 12px;
    border: 1px solid #cfe4d6;
    border-radius: 8px;
    background: #f6fbf7;
}

.audit-dynamic-fields.empty {
    display: none;
}

.audit-dynamic-fields[hidden] {
    display: none;
}

.audit-mapped-fields-head,
.audit-dynamic-fields-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.audit-mapped-fields-head {
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7fbfc;
}

.audit-mapped-fields-head.mapped-fields-locked {
    border-color: #d8e3e8;
    background: #f4f8f9;
}

.audit-mapped-fields-head[hidden] {
    display: none;
}

.audit-mapped-fields-head strong,
.audit-dynamic-fields-head strong {
    color: var(--text);
    font-size: 14px;
}

.audit-mapped-fields-head span,
.audit-dynamic-fields-head span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.audit-mapped-fields-head.mapped-fields-locked strong,
.audit-mapped-fields-head.mapped-fields-locked span {
    color: #697983;
}

.audit-dynamic-fields-head span {
    color: #227846;
}

.audit-dynamic-fields-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 10px;
}

.audit-dynamic-field {
    display: grid;
    gap: 6px;
}

.audit-dynamic-field span {
    display: grid;
    gap: 2px;
}

.audit-dynamic-field strong {
    color: var(--text);
    font-size: 13px;
}

.audit-dynamic-field small {
    color: var(--muted);
    font-family: Consolas, "Courier New", monospace;
    font-size: 10px;
    overflow-wrap: anywhere;
}

.audit-tax-tag-values .info {
    min-height: 46px;
    padding: 7px 9px;
}

.audit-tax-tag-values .info span {
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
}

.audit-tax-tag-values .info strong {
    margin-top: 3px;
    font-size: 12px;
    line-height: 1.18;
}

.audit-parameter-description-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    margin-top: 2px;
    padding: 8px 10px;
    border-top: 1px solid var(--line);
    background: #f7fbfc;
}

.audit-parameter-description-row span {
    margin-top: 0;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0;
    text-transform: uppercase;
}

.audit-parameter-description-row strong {
    margin: 0;
    color: var(--text);
    font-size: 12px;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.import-warning {
    grid-column: 1 / -1;
    display: grid;
    gap: 5px;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid #f0b5ad;
    border-left: 4px solid var(--bad);
    border-radius: 8px;
    background: #fff4f2;
    color: var(--text);
}

.import-warning strong {
    color: var(--bad);
    font-size: 13px;
}

.import-warning span,
.import-warning small {
    color: #66322d;
    line-height: 1.35;
}

.badge {
    align-self: start;
    padding: 5px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
}

.badge.ok {
    background: #dff5eb;
    color: var(--ok);
}

.badge.warn {
    background: #fff1d6;
    color: var(--warn);
}

.badge.bad {
    background: #ffe7e3;
    color: var(--bad);
}

.item-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: flex-end;
    gap: 8px;
}

.settings-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    padding: 18px;
    border-bottom: 1px solid var(--line);
}

.settings-form label {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.settings-form input,
.settings-form select,
.settings-form textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 8px 10px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
}

.settings-form input.field-has-value,
.settings-form select.field-has-value,
.settings-form textarea.field-has-value {
    border-color: #96d4ae;
    background: #effaf3;
    box-shadow: inset 0 0 0 1px rgba(53, 150, 93, 0.08);
}

.settings-form label.field-has-value > span {
    color: #227846;
}

.settings-form input::placeholder,
.settings-form textarea::placeholder {
    color: #9aa8af;
}

.settings-form input,
.settings-form select {
    height: 42px;
}

.settings-form select[multiple] {
    height: auto;
    min-height: 96px;
}

.settings-form textarea {
    min-height: 92px;
    resize: vertical;
}

.import-path-block {
    display: grid;
    gap: 6px;
}

.field-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
    font-size: 13px;
}

.field-head > span {
    min-width: 150px;
}

.field-controls {
    display: flex;
    flex: 1;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    min-width: 0;
}

.check-pill,
.compact-field {
    display: inline-flex !important;
    align-items: center;
    gap: 7px !important;
    width: auto;
    min-height: 34px;
    padding: 5px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f7fbfc;
    color: var(--text) !important;
    font-size: 12px !important;
    font-weight: 700;
}

.check-pill input {
    width: 16px !important;
    height: 16px !important;
    padding: 0 !important;
    accent-color: var(--brand);
}

.compact-field input,
.compact-field select {
    height: 30px !important;
    padding: 4px 7px !important;
    font-size: 12px;
}

.compact-field input {
    width: 68px !important;
}

.source-action-field select {
    width: 172px !important;
}

.settings-form input:disabled,
.settings-form select:disabled {
    background: #edf3f5;
    color: #7b8a92;
    cursor: not-allowed;
}

.tooltip-host {
    position: relative;
    cursor: help;
}

.tooltip-host::after {
    content: attr(data-tooltip);
    position: absolute;
    right: 0;
    bottom: calc(100% + 8px);
    z-index: 60;
    width: min(420px, calc(100vw - 32px));
    padding: 9px 10px;
    border: 1px solid #b9cbd2;
    border-radius: 8px;
    background: #172026;
    color: #ffffff;
    box-shadow: var(--shadow);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.35;
    opacity: 0;
    pointer-events: none;
    transform: translateY(4px);
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.tooltip-host:hover::after,
.tooltip-host:focus-within::after {
    opacity: 1;
    transform: translateY(0);
}

.user-form {
    grid-template-columns: minmax(170px, 1fr) minmax(140px, 0.75fr) minmax(240px, 1.2fr) minmax(140px, 0.65fr) minmax(160px, 0.8fr) auto;
    align-items: end;
}

.user-form .user-company-create {
    grid-column: 1 / span 5;
}

.user-form .form-actions {
    grid-column: 6;
}

.email-form {
    grid-template-columns: repeat(3, minmax(180px, 1fr));
    align-items: end;
}

.database-connections-form {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    align-items: end;
}

.connection-section-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 0 2px;
    border-top: 1px solid var(--line);
}

.connection-section-title:first-child {
    border-top: 0;
    padding-top: 0;
}

.connection-section-title strong {
    font-size: 14px;
}

.connection-state {
    display: inline-flex;
    align-items: center;
    min-height: 26px;
    padding: 4px 8px;
    border-radius: 8px;
    background: #f2f7f8;
    font-size: 12px;
    font-weight: 800;
}

.connection-state.ok {
    background: #e7f6ef;
    color: var(--ok);
}

.connection-state.warn {
    background: #fff4dd;
    color: var(--warn);
}

.database-source-objects {
    display: grid;
    gap: 8px;
    padding: 10px 0 4px;
    border-top: 1px solid var(--line);
}

.database-source-objects-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
}

.database-source-objects-head strong {
    color: var(--text);
    font-size: 13px;
}

.database-source-object-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 8px;
}

.database-source-object {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fbfc;
}

.database-source-object b {
    font-size: 12px;
}

.database-source-object code {
    overflow: hidden;
    color: #28515c;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.database-connection-actions {
    gap: 8px;
}

.audit-parameter-form {
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
}

.audit-rule-row,
.audit-tax-row,
.audit-nfse-row {
    display: grid;
    align-items: end;
    gap: 10px;
}

.audit-rule-row {
    grid-template-columns: minmax(210px, 1.3fr) minmax(104px, 0.55fr) minmax(220px, 1.25fr) minmax(118px, 0.65fr) minmax(118px, 0.65fr) auto auto auto;
}

.audit-tax-row {
    grid-template-columns: repeat(auto-fit, minmax(92px, 1fr));
}

.audit-tax-row.mapped-fields-locked {
    padding: 10px;
    border: 1px solid #d8e3e8;
    border-radius: 8px;
    background: #f8fbfc;
}

.audit-nfse-row {
    grid-template-columns: minmax(180px, 1fr) minmax(104px, 0.6fr) auto auto auto;
}

.audit-tax-row[hidden],
.audit-nfse-row[hidden] {
    display: none;
}

.audit-tax-row label,
.audit-nfse-row label {
    gap: 5px;
    min-width: 0;
    font-size: 12px;
}

.audit-tax-row label > span,
.audit-nfse-row label > span {
    display: flex;
    align-items: end;
    min-height: 28px;
    line-height: 1.18;
}

.audit-tax-row.mapped-fields-locked label > span {
    color: #697983;
}

.audit-tax-row input,
.audit-nfse-row input {
    padding-inline: 8px;
}

.audit-tax-row.mapped-fields-locked input,
.audit-tax-row.mapped-fields-locked select,
.audit-tax-row.mapped-fields-locked textarea {
    border-color: #d3dee4;
    background: #eef4f6;
    color: #74838c;
}

.audit-parameter-description textarea {
    min-height: 58px;
    background: #f7fbfc;
}

.audit-parameter-actions {
    align-self: end;
    gap: 8px;
}

.email-test-form {
    grid-template-columns: minmax(240px, 420px) auto;
    align-items: end;
    border-top: 1px solid var(--line);
}

.email-status {
    padding: 0;
    border: 0;
}

.user-form .form-actions {
    align-self: end;
    justify-content: flex-end;
}

.user-form .command {
    height: 42px;
    white-space: nowrap;
}

.wide {
    grid-column: 1 / -1;
}

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

.command {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: auto;
    min-width: 122px;
    height: 40px;
    padding: 0 14px;
    font-weight: 700;
}

.command.loading {
    cursor: wait;
}

.command.loading::before {
    content: "";
    width: 13px;
    height: 13px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    opacity: 0.9;
    animation: command-spin 0.72s linear infinite;
}

@keyframes command-spin {
    to {
        transform: rotate(360deg);
    }
}

.command.primary {
    border-color: var(--brand);
    background: var(--brand);
    color: #ffffff;
}

.command.alert {
    border-color: #a9c87a;
    background: #f5fbeb;
    color: #48660a;
}

.command.alert:hover,
.command.alert:focus-visible {
    border-color: #7f9e43;
    background: #e8f5d5;
    color: #334e03;
}

.command.danger {
    min-width: 82px;
    height: 30px;
    padding: 0 10px;
    border-color: #f0b5ad;
    color: var(--bad);
    box-shadow: none;
    font-size: 12px;
}

.status-strip {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
    padding: 18px 18px 0;
}

.status-strip:empty {
    display: none;
}

.monitor-summary,
.import-summary {
    position: relative;
    grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
    margin: 14px 18px 0;
    padding: 42px 12px 12px;
    border: 1px solid #c7d9df;
    border-radius: 8px;
    background: #f7fbfc;
}

.monitor-summary:not(:empty)::before,
.import-summary:not(:empty)::before {
    position: absolute;
    top: 12px;
    left: 12px;
    color: #31464f;
    font-size: 12px;
    font-weight: 900;
    letter-spacing: 0;
    text-transform: uppercase;
}

.monitor-summary:not(:empty)::before {
    content: "Monitor automatico";
}

.import-summary:not(:empty)::before {
    content: "Resultado da importacao";
}

.import-summary {
    border-color: #a9cfd7;
    background: #f2fafb;
}

.report-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(134px, 1fr));
    align-items: end;
    gap: 6px;
    padding: 8px 18px 0;
}

.report-filters .wide-filter {
    grid-column: span 2;
}

.report-filters label {
    display: grid;
    gap: 3px;
    min-width: 0;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
}

.report-filters input,
.report-filters select {
    width: 100%;
    height: 24px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 3px 7px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
    font-size: 11px;
}

.report-filters select {
    appearance: none;
    padding-right: 24px;
    background:
        linear-gradient(45deg, transparent 50%, var(--brand-dark) 50%) calc(100% - 14px) 10px / 5px 5px no-repeat,
        linear-gradient(135deg, var(--brand-dark) 50%, transparent 50%) calc(100% - 10px) 10px / 5px 5px no-repeat,
        #ffffff;
}

.report-filters .check-filter {
    display: flex;
    align-items: center;
    gap: 6px;
    min-height: 24px;
    padding: 0 7px;
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #ffffff;
    color: var(--text);
    overflow-wrap: anywhere;
}

.report-filters .check-filter input {
    width: 12px;
    height: 12px;
    accent-color: var(--brand);
}

.report-filter-actions {
    display: grid;
    gap: 4px;
    align-self: end;
}

.report-filters .command {
    min-width: 72px;
    width: 100%;
    height: 24px;
    min-height: 24px;
    padding: 0 8px;
    font-size: 11px;
}

.audit-report {
    display: grid;
    gap: 10px;
    padding: 14px 18px 0;
}

.report-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(112px, 132px));
    justify-content: start;
    gap: 6px;
}

.report-card,
.report-cfop-card,
.report-rule,
.report-empty,
.report-next,
.report-list-footer,
.report-table-wrap {
    border: 1px solid var(--line);
    border-radius: 4px;
    background: #ffffff;
}

.report-card {
    display: grid;
    align-content: space-between;
    min-width: 0;
    min-height: 38px;
    padding: 5px 8px;
}

.report-card.interactive {
    cursor: pointer;
    transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.15s ease;
}

.report-card.interactive:hover,
.report-card.interactive:focus-visible {
    border-color: var(--brand);
    box-shadow: 0 4px 12px rgba(18, 108, 121, 0.12);
    outline: none;
}

.report-card.interactive:active {
    transform: translateY(1px);
}

.report-cfop-card {
    grid-column: span 3;
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    align-items: center;
    gap: 8px;
    min-width: 0;
    min-height: 38px;
    padding: 5px 8px;
}

.report-inline-filter {
    display: grid;
    gap: 3px;
    min-width: 0;
    padding: 0;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
}

.report-inline-filter select {
    width: 100%;
    height: 20px;
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 20px 1px 6px;
    background:
        linear-gradient(45deg, transparent 50%, var(--brand-dark) 50%) calc(100% - 12px) 8px / 5px 5px no-repeat,
        linear-gradient(135deg, var(--brand-dark) 50%, transparent 50%) calc(100% - 8px) 8px / 5px 5px no-repeat,
        #ffffff;
    color: var(--text);
    font: inherit;
    font-size: 11px;
    appearance: none;
}

.report-cfop-legend {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    min-height: 0;
    padding: 0;
    color: var(--muted);
    font-size: 10.5px;
    font-weight: 700;
}

.report-cfop-legend strong {
    padding: 2px 5px;
    border: 1px solid #d4e0e5;
    border-radius: 4px;
    background: #f7fafb;
    color: #334850;
    font-size: 10.5px;
}

.report-card span,
.report-rule span,
.report-next span,
.report-more {
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.15;
}

.report-card strong,
.report-rule strong {
    display: block;
    margin-top: 4px;
    min-width: 0;
    overflow-wrap: anywhere;
    color: var(--text);
    font-size: 14px;
    line-height: 1.05;
}

.report-card.ok strong {
    color: var(--ok);
}

.report-card.bad strong {
    color: var(--bad);
}

.report-rule,
.report-empty,
.report-next,
.report-list-footer {
    padding: 10px;
}

.report-rule strong {
    margin-top: 0;
    font-size: 13px;
}

.report-empty {
    color: var(--ok);
    font-size: 13px;
    font-weight: 700;
}

.report-next {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.report-next strong {
    max-width: 100%;
    overflow-wrap: anywhere;
    padding: 4px 8px;
    border: 1px solid #d4e0e5;
    border-radius: 999px;
    color: #334850;
    font-size: 11px;
}

.report-table-wrap {
    max-width: 100%;
    container-type: inline-size;
    overflow-x: auto;
    overflow-y: visible;
    padding-bottom: 8px;
    scrollbar-gutter: stable;
}

.report-table {
    width: 100%;
    min-width: 1120px;
    border-collapse: collapse;
    font-size: 12px;
    table-layout: auto;
}

.nfse-report-table {
    min-width: 1580px;
}

.tipi-list {
    gap: 8px;
}

.tipi-result-line {
    display: flex;
    align-items: baseline;
    gap: 6px;
    color: var(--muted);
    font-size: 12px;
}

.tipi-result-line strong {
    color: var(--text);
    font-size: 16px;
}

.tipi-table {
    min-width: 1120px;
}

.tipi-table th:nth-child(1),
.tipi-table td:nth-child(1) {
    width: 130px;
    white-space: nowrap;
}

.tipi-table th:nth-child(2),
.tipi-table td:nth-child(2),
.tipi-table th:nth-child(5),
.tipi-table td:nth-child(5),
.tipi-table th:nth-child(6),
.tipi-table td:nth-child(6) {
    width: 96px;
    white-space: nowrap;
}

.tipi-table th:nth-child(4),
.tipi-table td:nth-child(4) {
    width: 150px;
}

.classificacao-table {
    min-width: 1360px;
}

.classificacao-table th:nth-child(1),
.classificacao-table td:nth-child(1) {
    width: 260px;
}

.classificacao-table th:nth-child(2),
.classificacao-table td:nth-child(2) {
    width: 145px;
}

.classificacao-table th:nth-child(3),
.classificacao-table td:nth-child(3) {
    width: 360px;
}

.classificacao-table th:nth-child(4),
.classificacao-table td:nth-child(4) {
    width: 210px;
}

.classificacao-table th:nth-child(5),
.classificacao-table td:nth-child(5),
.classificacao-table th:nth-child(6),
.classificacao-table td:nth-child(6),
.classificacao-table th:nth-child(7),
.classificacao-table td:nth-child(7) {
    width: 125px;
}

.classif-reference-cell strong {
    margin-right: 4px;
    font-size: 12px;
}

.convenio-table {
    min-width: 1320px;
}

.convenio-reducao-table {
    min-width: 1380px;
}

.convenio-uso-table {
    min-width: 980px;
}

.aud-convenio-table {
    min-width: 1680px;
}

.convenio-uso-table th:nth-child(1),
.convenio-uso-table td:nth-child(1) {
    width: 320px;
}

.convenio-uso-table th:nth-child(2),
.convenio-uso-table td:nth-child(2),
.convenio-uso-table th:nth-child(3),
.convenio-uso-table td:nth-child(3),
.convenio-uso-table th:nth-child(5),
.convenio-uso-table td:nth-child(5),
.convenio-uso-table th:nth-child(6),
.convenio-uso-table td:nth-child(6) {
    width: 120px;
}

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

.aud-convenio-table th:nth-child(2),
.aud-convenio-table td:nth-child(2),
.aud-convenio-table th:nth-child(3),
.aud-convenio-table td:nth-child(3) {
    width: 280px;
}

.aud-convenio-table th:nth-child(4),
.aud-convenio-table td:nth-child(4),
.aud-convenio-table th:nth-child(5),
.aud-convenio-table td:nth-child(5),
.aud-convenio-table th:nth-child(6),
.aud-convenio-table td:nth-child(6),
.aud-convenio-table th:nth-child(7),
.aud-convenio-table td:nth-child(7) {
    width: 180px;
}

.aud-convenio-table th:nth-child(8),
.aud-convenio-table td:nth-child(8) {
    width: 100px;
}

.convenio-table th:nth-child(1),
.convenio-table td:nth-child(1),
.convenio-table th:nth-child(2),
.convenio-table td:nth-child(2),
.convenio-table th:nth-child(3),
.convenio-table td:nth-child(3) {
    width: 105px;
}

.convenio-table th:nth-child(4),
.convenio-table td:nth-child(4) {
    width: 130px;
}

.convenio-table th:nth-child(5),
.convenio-table td:nth-child(5) {
    width: 560px;
}

.convenio-table th:nth-child(6),
.convenio-table td:nth-child(6) {
    width: 210px;
}

.convenio-reducao-table th:nth-child(1),
.convenio-reducao-table td:nth-child(1),
.convenio-reducao-table th:nth-child(2),
.convenio-reducao-table td:nth-child(2),
.convenio-reducao-table th:nth-child(4),
.convenio-reducao-table td:nth-child(4) {
    width: 105px;
}

.convenio-reducao-table th:nth-child(3),
.convenio-reducao-table td:nth-child(3),
.convenio-reducao-table th:nth-child(5),
.convenio-reducao-table td:nth-child(5),
.convenio-reducao-table th:nth-child(6),
.convenio-reducao-table td:nth-child(6),
.convenio-reducao-table th:nth-child(7),
.convenio-reducao-table td:nth-child(7) {
    width: 220px;
}

.convenio-section-title {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 4px;
    padding: 8px 10px;
    border: 1px solid #c7d9df;
    border-radius: 4px;
    background: #f5fafb;
}

.convenio-section-title strong {
    color: var(--text);
    font-size: 13px;
}

.convenio-section-title span {
    min-width: 0;
    color: var(--muted);
    font-size: 11px;
    overflow-wrap: anywhere;
}

.cell-stack {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.cell-stack strong {
    color: var(--text);
    font-weight: 700;
}

.cell-stack span,
.muted {
    color: var(--muted);
    font-size: 12px;
}

.report-table th,
.report-table td {
    padding: 7px 8px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
    white-space: normal;
    overflow-wrap: anywhere;
    line-height: 1.25;
}

.report-table th {
    background: #f3f7f8;
    color: #37505a;
    font-size: 11px;
    text-transform: uppercase;
}

.report-position-head,
.report-position-cell {
    position: sticky;
    left: 0;
    z-index: 2;
    min-width: 48px;
    width: 48px;
    text-align: center !important;
}

.report-position-head {
    z-index: 3;
    box-shadow: 1px 0 0 var(--line);
}

.report-position-cell {
    background: #fbfdfe;
    box-shadow: 1px 0 0 var(--line);
    color: #37505a;
    font-weight: 800;
}

.report-note-cell {
    width: 1%;
    min-width: 68px;
    white-space: nowrap !important;
}

.report-date-cell {
    width: 1%;
    min-width: 90px;
    white-space: nowrap !important;
}

.report-supplier-cell {
    width: 1%;
    min-width: 142px;
    max-width: 150px;
    white-space: nowrap !important;
}

.report-product-cell {
    min-width: 280px;
    max-width: none;
}

.report-item-cell {
    min-width: 150px;
    max-width: 190px;
}

.report-money-cell {
    width: 1%;
    min-width: 96px;
    text-align: right !important;
    white-space: nowrap !important;
}

.report-rate-cell {
    width: 1%;
    min-width: 64px;
    text-align: right !important;
    white-space: nowrap !important;
}

.report-status-cell {
    width: 1%;
    min-width: 94px;
    white-space: nowrap !important;
}

.report-issues {
    min-width: 180px;
    max-width: 260px;
}

.report-files-cell {
    width: 1%;
    min-width: 146px;
    text-align: left !important;
}

.report-recipient-cell {
    width: 1%;
    min-width: 142px;
    max-width: 170px;
    white-space: nowrap !important;
}

.report-files-head {
    text-align: left !important;
}

.report-cell-text {
    display: -webkit-box;
    max-height: 2.5em;
    overflow: hidden;
    overflow-wrap: anywhere;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
}

.report-note-cell .report-cell-text,
.report-date-cell .report-cell-text,
.report-recipient-cell .report-cell-text,
.report-money-cell .report-cell-text,
.report-rate-cell .report-cell-text {
    display: block;
    max-height: none;
    white-space: nowrap;
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

.report-supplier-cell .report-cell-text {
    display: block;
    width: max-content;
    max-width: 142px;
    max-height: none;
    white-space: nowrap;
    -webkit-line-clamp: unset;
    line-clamp: unset;
}

.report-product-cell .report-cell-text {
    width: auto;
    max-width: none;
}

.report-item-cell .report-cell-text {
    width: max-content;
    max-width: 180px;
}

.report-recipient-cell .report-cell-text {
    width: max-content;
    max-width: 162px;
}

.nfse-report-table .report-supplier-cell {
    min-width: 120px;
    max-width: 147px;
}

.nfse-report-table .report-supplier-cell .report-cell-text {
    max-width: 147px;
}

.nfse-report-table .report-product-cell {
    min-width: 182px;
    max-width: 210px;
}

.nfse-report-table .report-product-cell .report-cell-text {
    max-width: 210px;
}

.nfse-report-table .report-item-cell {
    min-width: 64px;
    max-width: 86px;
}

.nfse-report-table .report-item-cell .report-cell-text {
    max-width: 80px;
}

.nfse-report-table .report-money-cell {
    min-width: 92px;
    text-align: left !important;
}

.nfse-report-table .report-rate-cell {
    min-width: 58px;
    text-align: left !important;
}

.nfse-report-table .report-status-cell {
    min-width: 92px;
}

.nfse-report-table .report-issues {
    min-width: 220px;
    max-width: 300px;
}

.nfse-report-table .report-files-cell {
    min-width: 98px;
}

.nfse-report-table th,
.nfse-report-table td,
.nfse-report-table .report-position-head,
.nfse-report-table .report-position-cell {
    text-align: left !important;
}

.nfse-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    max-width: 100%;
    padding: 3px 7px;
    border: 1px solid #afdcc7;
    border-radius: 4px;
    background: #f0fbf6;
    color: #245f47;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.2;
}

.nfse-status-badge.warn {
    border-color: #ead39b;
    background: #fff8e7;
    color: #73540d;
}

.nfse-status-badge.bad {
    border-color: #f0b5ad;
    background: #fff4f2;
    color: #743028;
}

.report-check-list {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 4px;
    width: max-content;
    max-width: 100%;
}

.report-check {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 4px;
    max-width: 100%;
    margin: 0;
    padding: 3px 7px;
    border: 1px solid #f0d0ca;
    border-radius: 4px;
    background: #fff6f4;
    color: #743028;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
    white-space: normal;
}

.report-check.bad {
    border-color: #f0b5ad;
    background: #fff4f2;
}

.report-check.ok {
    border-color: #afdcc7;
    background: #f0fbf6;
    color: #245f47;
}

.report-check.warn {
    border-color: #ead39b;
    background: #fff8e7;
    color: #73540d;
}

.report-check.info {
    border-color: #c8d8df;
    background: #f7fbfc;
    color: #37505a;
}

.report-check.action {
    cursor: pointer;
    box-shadow: 0 0 0 1px rgba(229, 188, 99, 0.2);
}

.report-check.action:hover,
.report-check.action:focus-visible {
    border-color: var(--brand);
    background: #eef9fb;
    color: var(--brand-dark);
    outline: none;
}

.report-issues b,
.report-check em {
    min-width: 0;
    overflow-wrap: anywhere;
}

.report-issues b,
.report-check.bad .report-actual {
    color: var(--bad);
}

.report-check.ok b,
.report-check.ok .report-expected,
.report-check.ok .report-actual,
.report-expected {
    color: var(--ok);
}

.report-check.warn b,
.report-check.warn .report-expected,
.report-check.warn .report-actual {
    color: #73540d;
}

.report-check.info b,
.report-check.info .report-actual {
    color: #37505a;
}

.report-check em {
    font-style: normal;
}

.report-file-actions {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 5px;
    width: max-content;
    max-width: 100%;
}

.report-cce-link {
    order: 3;
}

.report-note-link,
.report-pdf-link {
    order: 1;
}

.report-xml-link {
    order: 2;
}

.report-note-link,
.report-pdf-link,
.report-xml-link,
.report-cce-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    min-width: 40px;
    min-height: 22px;
    padding: 2px 0;
    border: 1px solid #8fb6c0;
    border-radius: 8px;
    background: #f8fcfd;
    color: var(--brand) !important;
    font-size: 10px;
    font-weight: 800;
    line-height: 1;
    overflow-wrap: normal;
    text-decoration: none;
    white-space: nowrap;
    word-break: normal;
}

.report-note-link {
    width: 48px;
    min-width: 48px;
}

.report-xml-link {
    border-color: #b8c9ba;
    background: #f8fbf7;
    color: #2f6f46 !important;
}

.report-cce-link {
    border-color: #d5bd76;
    background: #fffaf0;
    color: #7a5900 !important;
}

.report-note-link:hover,
.report-pdf-link:hover,
.report-xml-link:hover,
.report-cce-link:hover {
    background: var(--brand);
    color: #ffffff !important;
}

.report-more {
    display: flex;
    flex-wrap: wrap;
    gap: 3px 4px;
    max-width: 100%;
    padding: 8px;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.report-more span {
    min-width: 0;
}

.users-list {
    display: grid;
    gap: 8px;
    padding: 14px 18px 18px;
}

.users-list.empty {
    color: var(--muted);
    font-weight: 700;
}

.user-item {
    display: grid;
    grid-template-columns: minmax(120px, 0.55fr) minmax(250px, 1fr) minmax(205px, 0.78fr) minmax(420px, 1.45fr) minmax(176px, auto);
    grid-template-areas:
        "identity email profile companies actions"
        "status login profile companies actions";
    align-items: stretch;
    gap: 10px;
    padding: 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.user-item.master-user {
    border-color: #b8d6de;
    background: #f8fcfd;
}

.user-cell {
    display: grid;
    align-content: center;
    gap: 2px;
    min-width: 0;
}

.user-main-cell {
    grid-area: identity;
}

.user-email-cell {
    grid-area: email;
}

.user-profile-cell {
    grid-area: profile;
}

.user-company-cell {
    grid-area: companies;
}

.user-status-cell {
    grid-area: status;
}

.user-login-cell {
    grid-area: login;
}

.user-actions {
    grid-area: actions;
    align-self: center;
}

.user-cell span,
.user-cell small {
    color: var(--muted);
    font-size: 11px;
}

.user-cell strong {
    overflow: hidden;
    color: var(--text);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inline-edit,
.user-actions {
    display: flex;
    align-items: center;
    gap: 6px;
    min-width: 0;
}

.inline-edit input,
.inline-edit select {
    flex: 1 1 132px;
    min-width: 128px;
    max-width: 150px;
    height: 32px;
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 4px 8px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
    font-size: 12px;
}

.inline-edit input[type="email"] {
    flex-basis: 210px;
    min-width: 178px;
    max-width: none;
}

.user-email-edit {
    flex-wrap: wrap;
}

.user-profile-cell .inline-edit {
    flex-wrap: nowrap;
}

.user-profile-cell select {
    min-width: 118px;
    max-width: 142px;
}

.user-company-edit {
    display: grid;
    grid-template-columns: minmax(320px, 1fr) auto;
    align-items: flex-start;
    width: 100%;
}

.user-company-edit select[multiple] {
    width: 100%;
    min-width: 320px;
    max-width: none;
    height: 86px;
    padding-block: 5px;
}

.mini-check {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    height: 32px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}

.mini-check input {
    width: 14px;
    height: 14px;
    accent-color: var(--brand);
}

.inline-edit .command,
.user-actions .command {
    min-width: 68px;
    height: 32px;
    padding: 0 9px;
    font-size: 12px;
}

.user-actions {
    flex-wrap: nowrap;
    justify-content: flex-end;
}

.profile-form {
    grid-template-columns: minmax(160px, 0.9fr) minmax(240px, 1.35fr) minmax(92px, auto) minmax(120px, auto) auto;
    gap: 8px;
    padding: 12px;
}

.profile-panel .panel-head {
    padding: 12px 14px;
}

.profile-panel .panel-head h2 {
    font-size: 15px;
}

.profile-panel .panel-head p {
    font-size: 12px;
}

.profile-form .profile-description-field {
    grid-column: auto;
}

.profile-form label {
    gap: 4px;
    font-size: 12px;
}

.profile-form input,
.profile-form select {
    height: 36px;
    padding: 6px 8px;
    font-size: 12px;
}

.profile-form .check-pill {
    min-height: 36px;
    padding: 5px 8px;
}

.profile-form .command {
    height: 36px;
}

.permissions-matrix {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 6px;
    padding: 0 12px 10px;
}

.permissions-matrix.empty {
    display: block;
    color: var(--muted);
    font-weight: 700;
}

.permission-module {
    display: grid;
    gap: 4px;
    min-width: 0;
    margin: 0;
    padding: 7px 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
}

.permission-module legend {
    padding: 0 4px;
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
}

.permission-check {
    display: grid;
    grid-template-columns: 14px minmax(0, 1fr);
    align-items: center;
    gap: 5px;
    min-width: 0;
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
}

.permission-check input {
    width: 12px;
    height: 12px;
    accent-color: var(--brand);
}

.permission-check span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-panel .list {
    gap: 6px;
    padding: 10px 12px 12px;
}

.profile-item {
    display: grid;
    grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.15fr) auto;
    align-items: center;
    gap: 8px;
    min-width: 0;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fbfcfd;
}

.profile-summary {
    display: grid;
    gap: 2px;
    min-width: 0;
}

.profile-summary strong,
.profile-summary span,
.profile-meta-row code {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.profile-summary strong {
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
}

.profile-summary span {
    color: var(--muted);
    font-size: 11px;
}

.profile-meta-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px;
    min-width: 0;
}

.profile-chip,
.profile-meta-row code {
    display: inline-flex;
    align-items: center;
    max-width: 180px;
    min-height: 23px;
    padding: 3px 7px;
    border: 1px solid #c9d6dc;
    border-radius: 999px;
    background: #ffffff;
    color: #40525a;
    font-size: 10.5px;
    font-weight: 800;
}

.profile-chip.ok {
    border-color: #9bd9c1;
    background: #f0fbf6;
    color: var(--ok);
}

.profile-chip.warn {
    border-color: #efcf93;
    background: #fff8ea;
    color: var(--warn);
}

.profile-meta-row code {
    border-radius: 7px;
    font-family: Consolas, "Courier New", monospace;
    font-weight: 700;
}

.profile-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.profile-actions .command {
    min-width: 68px;
    height: 30px;
    padding: 0 9px;
    font-size: 12px;
}

.toast {
    position: fixed;
    right: 18px;
    bottom: 18px;
    z-index: 40;
    max-width: min(420px, calc(100vw - 36px));
    padding: 12px 14px;
    border: 1px solid #9bd9c1;
    border-radius: 8px;
    background: #f0fbf6;
    color: var(--ok);
    box-shadow: var(--shadow);
    font-size: 14px;
    font-weight: 700;
}

.toast.bad {
    border-color: #f0b5ad;
    background: #fff4f2;
    color: var(--bad);
}

.process-overlay {
    position: fixed;
    inset: 0;
    z-index: 35;
    display: grid;
    place-items: center;
    padding: 18px;
    background: rgba(23, 32, 38, 0.32);
}

.process-dialog {
    width: min(520px, 100%);
    border: 1px solid #cddbe1;
    border-radius: 8px;
    background: #ffffff;
    box-shadow: var(--shadow);
    overflow: hidden;
}

.process-head {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    padding: 16px;
    border-bottom: 1px solid var(--line);
}

.process-head h2 {
    font-size: 18px;
    line-height: 1.2;
}

.process-head p {
    margin-top: 4px;
    color: var(--muted);
    font-size: 13px;
}

.process-head span {
    align-self: start;
    min-width: 84px;
    height: 28px;
    padding: 5px 9px;
    border: 1px solid #b6d8df;
    border-radius: 8px;
    background: #eef9fb;
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 800;
    text-align: center;
    white-space: nowrap;
}

.process-head span.ok {
    border-color: #9bd9c1;
    background: #f0fbf6;
    color: var(--ok);
}

.process-head span.bad {
    border-color: #f0b5ad;
    background: #fff4f2;
    color: var(--bad);
}

.process-steps {
    display: grid;
    gap: 0;
    margin: 0;
    padding: 0;
    list-style: none;
}

.process-steps li {
    position: relative;
    min-height: 46px;
    padding: 14px 16px 14px 44px;
    border-bottom: 1px solid #edf2f4;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.process-steps li:last-child {
    border-bottom: 0;
}

.process-steps li::before {
    content: "";
    position: absolute;
    left: 16px;
    top: 15px;
    width: 15px;
    height: 15px;
    border: 2px solid #a7b6bd;
    border-radius: 50%;
    background: #ffffff;
}

.process-steps li.active {
    color: var(--brand-dark);
    background: #f2fafb;
}

.process-steps li.active::before {
    border-color: var(--brand);
    border-top-color: transparent;
    animation: process-spin 0.8s linear infinite;
}

.process-steps li.done {
    color: var(--ok);
}

.process-steps li.done::before {
    border-color: var(--ok);
    background: var(--ok);
    box-shadow: inset 0 0 0 3px #ffffff;
}

@keyframes process-spin {
    to {
        transform: rotate(360deg);
    }
}

.hidden {
    display: none !important;
}

@container (max-width: 1080px) {
    .report-table {
        width: 100%;
        min-width: 0;
        border-collapse: separate;
        border-spacing: 0 8px;
    }

    .report-table thead {
        display: none;
    }

    .report-table,
    .report-table tbody,
    .report-table tr,
    .report-table td {
        display: block;
    }

    .report-table tr {
        border: 1px solid #cad8de;
        border-radius: 4px;
        background: #ffffff;
        box-shadow: 0 5px 14px rgba(28, 46, 55, 0.04);
        overflow: hidden;
    }

    .report-position-head,
    .report-position-cell {
        position: static;
        width: auto;
        min-width: 0;
        text-align: left !important;
        box-shadow: none;
    }

    .report-position-cell {
        background: #f3f7f8;
    }

    .report-table td {
        display: grid;
        grid-template-columns: minmax(118px, 0.3fr) minmax(0, 1fr);
        gap: 8px;
        width: auto;
        min-width: 0;
        max-width: none;
        padding: 8px 10px;
        border-bottom: 1px solid var(--line);
        white-space: normal;
    }

    .report-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 11px;
        font-weight: 800;
        text-transform: uppercase;
    }

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

    .report-table td .report-cell-text {
        display: block;
        max-height: none;
        overflow: visible;
        -webkit-line-clamp: unset;
        line-clamp: unset;
    }

    .report-issues,
    .report-files-cell,
    .report-note-cell,
    .report-date-cell,
    .report-supplier-cell,
    .report-recipient-cell,
    .report-product-cell,
    .report-item-cell {
        width: auto;
        min-width: 0;
        max-width: none;
    }

    .report-check-list {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        gap: 6px;
    }

    .report-check {
        display: grid;
        align-items: start;
        gap: 2px;
        padding: 6px 8px;
    }

}

@media (max-width: 1280px) {
    .dashboard-risk-panel .panel-head {
        display: grid;
        align-items: start;
    }

    .dashboard-period-form {
        width: 100%;
        grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(180px, 0.9fr) minmax(130px, auto) minmax(260px, auto);
    }

    .audit-rule-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .audit-tax-row,
    .audit-nfse-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }

    .user-item {
        grid-template-columns: minmax(120px, 0.75fr) minmax(230px, 1fr) minmax(340px, 1.3fr) minmax(150px, auto);
        grid-template-areas:
            "identity email companies actions"
            "profile profile companies actions"
            "status login companies actions";
    }

    .user-company-edit {
        grid-template-columns: minmax(260px, 1fr) auto;
    }

    .user-company-edit select[multiple] {
        min-width: 260px;
    }
}

@media (max-width: 1180px) {
    .topbar {
        flex-wrap: wrap;
        align-items: flex-start;
    }

    .top-company-selector {
        order: 3;
        width: min(100%, 760px);
        max-width: none;
    }

    .toolbar {
        order: 4;
        margin-left: auto;
    }
}

@media (max-width: 960px) {
    .content-grid,
    .dashboard-risk-body,
    .dashboard-grid,
    .user-item,
    .user-form,
    .settings-form {
        grid-template-columns: 1fr;
    }

    .user-actions {
        flex-wrap: wrap;
        justify-content: flex-start;
    }

    .user-item {
        grid-template-areas: none;
    }

    .user-main-cell,
    .user-email-cell,
    .user-profile-cell,
    .user-company-cell,
    .user-status-cell,
    .user-login-cell,
    .user-actions {
        grid-area: auto;
    }

    .user-form .user-company-create,
    .user-form .form-actions {
        grid-column: auto;
    }

    .user-company-edit {
        grid-template-columns: 1fr;
    }

    .user-company-edit select[multiple] {
        min-width: 0;
    }

    .profile-item {
        grid-template-columns: 1fr;
        align-items: start;
    }

    .profile-actions {
        justify-content: flex-start;
    }

    .field-head {
        align-items: flex-start;
        flex-direction: column;
    }

    .field-controls {
        justify-content: flex-start;
        width: 100%;
    }

    .audit-rule-row,
    .audit-tax-row,
    .audit-nfse-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    body.sidebar-open {
        overflow: hidden;
    }

    .shell {
        display: block;
        min-height: 100vh;
    }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 30;
        width: min(86vw, 320px);
        height: 100dvh;
        padding: 18px;
        gap: 18px;
        overflow: auto;
        transform: translateX(-104%);
        transition: transform 0.18s ease;
        box-shadow: 18px 0 44px rgba(15, 32, 38, 0.24);
    }

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

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

    .sidebar .nav button {
        text-align: left;
        padding-inline: 12px;
    }

    .mobile-menu-button {
        display: inline-flex;
        width: 42px;
        height: 42px;
        box-shadow: none;
    }

    .main {
        padding: 14px;
    }

    .topbar {
        position: sticky;
        top: 0;
        z-index: 12;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        gap: 10px;
        margin: -14px -14px 14px;
        padding: 12px 14px;
        border-bottom: 1px solid var(--line);
        background: rgba(244, 247, 249, 0.96);
    }

    .topbar h1 {
        font-size: 20px;
    }

    .topbar p {
        overflow: hidden;
        font-size: 12px;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .toolbar {
        grid-column: 1 / -1;
        justify-content: space-between;
    }

    .top-company-selector {
        grid-column: 1 / -1;
        width: 100%;
        min-width: 0;
        max-width: none;
    }

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

    .report-filters {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        padding-inline: 12px;
    }

    .report-filters .wide-filter,
    .report-filters .command {
        grid-column: 1 / -1;
    }

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

    .dashboard-risk {
        padding: 12px;
    }

    .dashboard-risk-summary {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-risk-card {
        min-height: 118px;
    }

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

    .dashboard-cfop-field {
        grid-column: 1 / -1;
    }

    .dashboard-venda-cfop-check {
        justify-content: flex-start;
    }

    .dashboard-period-actions {
        grid-column: 1 / -1;
    }

    .dashboard-risk-block-head,
    .dashboard-risk-event,
    .dashboard-risk-tax {
        grid-template-columns: 1fr;
    }

    .dashboard-risk-block-head {
        display: grid;
    }

    .dashboard-risk-block-head span,
    .dashboard-risk-tax b,
    .dashboard-risk-event-values {
        text-align: left;
    }

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

    .report-table thead {
        display: none;
    }

    .report-table,
    .report-table tbody,
    .report-table tr,
    .report-table td {
        display: block;
    }

    .report-table tr {
        border: 1px solid var(--line);
        border-radius: 4px;
        background: #ffffff;
        box-shadow: 0 5px 14px rgba(28, 46, 55, 0.04);
        overflow: hidden;
    }

    .report-position-head,
    .report-position-cell {
        position: static;
        width: auto;
        min-width: 0;
        text-align: left !important;
        box-shadow: none;
    }

    .report-position-cell {
        background: #f7fafb;
    }

    .report-table td {
        display: grid;
        grid-template-columns: minmax(96px, 0.36fr) minmax(0, 1fr);
        gap: 8px;
        min-width: 0;
        max-width: none;
        padding: 8px 10px;
        border-bottom: 1px solid var(--line);
        white-space: normal;
    }

    .report-table td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 11px;
        font-weight: 800;
        text-transform: uppercase;
    }

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

    .report-issues {
        min-width: 0;
        max-width: none;
    }

    .report-more {
        display: grid;
        grid-template-columns: 1fr;
    }

    .metrics article,
    .panel-head,
    .list,
    .settings-form {
        padding: 12px;
    }

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

    .compact-note {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        min-height: 0;
    }

    .compact-note-head {
        display: none;
    }

    .compact-note code {
        grid-column: 1 / -1;
    }

    .tax-strip {
        grid-template-columns: 1fr;
    }

    .audit-parameter-description-row {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .service-strip {
        grid-template-columns: 1fr;
    }

    .tax-pill {
        grid-template-columns: minmax(58px, 0.62fr) minmax(0, 1fr);
        min-height: 54px;
        row-gap: 3px;
    }

    .tax-pill strong {
        grid-column: 1;
        grid-row: 1;
    }

    .tax-value {
        grid-column: 2;
        grid-row: 1;
    }

    .tax-cst {
        grid-column: 1;
        grid-row: 2;
    }

    .tax-base {
        grid-column: 2;
        grid-row: 2;
    }

    .tax-rate {
        grid-column: 1 / -1;
        grid-row: 3;
        text-align: left;
    }

    .tax-ibs,
    .tax-cbs {
        min-height: 74px;
    }

    .tax-ibs .tax-cst,
    .tax-cbs .tax-cst {
        grid-column: 1 / -1;
        grid-row: 2;
        overflow: visible;
        text-overflow: clip;
        white-space: nowrap;
    }

    .tax-ibs .tax-base,
    .tax-cbs .tax-base {
        grid-column: 1 / -1;
        grid-row: 3;
    }

    .tax-ibs .tax-rate,
    .tax-cbs .tax-rate {
        grid-column: 1 / -1;
        grid-row: 4;
    }

    .pdf-link {
        justify-self: start;
    }

    .form-actions,
    .command {
        width: 100%;
    }
}

@media (max-width: 430px) {
    .main {
        padding: 10px;
    }

    .topbar {
        margin: -10px -10px 10px;
        padding: 10px;
    }

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

    .report-summary {
        grid-template-columns: 1fr;
    }

    .dashboard-risk-summary {
        grid-template-columns: 1fr;
    }

    .dashboard-period-form {
        grid-template-columns: 1fr;
    }

    .dashboard-period-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-period-actions .command {
        width: 100%;
    }

    .report-cfop-card {
        grid-column: auto;
        grid-template-columns: 1fr;
    }

    .report-filters {
        grid-template-columns: 1fr;
    }

    .report-filters .wide-filter,
    .report-filters .command {
        grid-column: auto;
    }

    .report-table td {
        grid-template-columns: 1fr;
        gap: 4px;
    }

    .check-pill,
    .compact-field,
    .source-action-field select {
        width: 100% !important;
    }

    .compact-field {
        justify-content: space-between;
    }

    .compact-field input {
        width: 96px !important;
    }
}
