:root {
    --bg: #063f55;
    --panel: #075a77;
    --panel-strong: #064b65;
    --text: #f4fbff;
    --muted: #b9d4e2;
    --line: rgba(149, 194, 213, .24);
    --brand: #18a8e8;
    --brand-dark: #dff5ff;
    --brand-soft: #0a6889;
    --brand-soft-strong: #0d789f;
    --surface: #e9edf0;
    --surface-text: #102033;
    --success-bg: #4bbf53;
    --success: #ffffff;
    --danger-bg: #ff453c;
    --danger: #ffffff;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Arial, Helvetica, sans-serif;
    font-size: 14px;
}

a {
    color: var(--brand);
    text-decoration: none;
}

.topbar {
    align-items: center;
    background: #075a77;
    border-bottom: 1px solid var(--line);
    box-shadow: 0 1px 0 rgba(0, 0, 0, .14);
    display: flex;
    gap: 28px;
    height: 58px;
    padding: 0 28px;
    position: sticky;
    top: 0;
    z-index: 5;
}

.session-box {
    align-items: center;
    display: flex;
    gap: 12px;
    margin-left: auto;
}

.session-box span {
    color: #d7edf7;
    font-weight: 700;
}

.session-box a {
    border: 1px solid rgba(255, 255, 255, .24);
    border-radius: 6px;
    color: #ffffff;
    font-weight: 700;
    padding: 7px 10px;
}

.brand {
    display: grid;
    gap: 2px;
    color: #ffffff;
    font-weight: 700;
    line-height: 1.1;
}

.brand span {
    font-size: 18px;
}

.brand small {
    color: #bde9fb;
    font-size: 11px;
    font-weight: 600;
}

.nav {
    display: flex;
    gap: 10px;
}

.nav a {
    border-radius: 6px;
    color: #d7edf7;
    font-weight: 600;
    padding: 8px 10px;
}

.nav a.active {
    background: #ffffff;
    color: #075a77;
}

.shell {
    margin: 0 auto;
    max-width: 1480px;
    padding: 28px;
}

.page-head {
    align-items: flex-end;
    display: flex;
    gap: 18px;
    justify-content: space-between;
    margin-bottom: 18px;
}

.client-detail-head {
    background: #5f7075;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 6px 6px 0 0;
    margin-bottom: 0;
    padding: 14px 18px;
}

.client-detail-head h1 {
    color: #ffffff;
    font-size: 26px;
}

.client-detail-head p,
.client-detail-head .eyebrow {
    color: #dce8ee;
}

.client-detail-head .metric {
    background: #eef1f3;
    border-color: #c7d0d6;
    color: #071d2b;
}

.client-detail-head .metric small {
    color: #4c626e;
}

.page-head h1 {
    font-size: 30px;
    letter-spacing: 0;
    line-height: 1.15;
    margin: 4px 0;
}

.page-head p {
    color: var(--muted);
    margin: 0;
}

.eyebrow {
    color: #9de2ff;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.metric {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    min-width: 170px;
    padding: 14px 16px;
    text-align: right;
}

.metric span {
    display: block;
    font-size: 22px;
    font-weight: 700;
}

.metric small,
td small {
    color: var(--muted);
}

.metric small,
td small {
    display: block;
    font-size: 12px;
    line-height: 1.4;
    margin-top: 4px;
}

.toolbar {
    align-items: flex-end;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(260px, 1fr) 180px auto auto;
    margin-bottom: 18px;
    padding: 16px;
}

.grid-window {
    background: #5f7075;
    border: 1px solid rgba(255, 255, 255, .16);
    border-radius: 6px;
    box-shadow: 0 14px 40px rgba(0, 0, 0, .18);
    margin-bottom: 16px;
    overflow: hidden;
}

.grid-title {
    color: #ffffff;
    font-size: 13px;
    font-weight: 700;
    padding: 10px 16px 4px;
    text-align: center;
}

.grid-toolbar {
    background: #5f7075;
    border: 0;
    border-radius: 0;
    margin: 0;
    padding: 10px;
}

.grid-toolbar label span {
    color: #ffffff;
}

.grid-toolbar button,
.grid-toolbar .button {
    height: 34px;
}

.grid-toolbar input,
.grid-toolbar select {
    height: 34px;
}

label span {
    color: #d7edf7;
    display: block;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 6px;
}

input,
select,
button,
.button {
    border-radius: 6px;
    font: inherit;
    height: 40px;
}

input,
select {
    background: #ffffff;
    border: 1px solid var(--line);
    color: var(--surface-text);
    padding: 0 12px;
    width: 100%;
}

input:focus,
select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(13, 110, 168, .12);
    outline: none;
}

button,
.button {
    align-items: center;
    background: #0f9ed5;
    border: 1px solid #0f9ed5;
    color: #fff;
    cursor: pointer;
    display: inline-flex;
    font-weight: 700;
    justify-content: center;
    padding: 0 16px;
}

.button.secondary {
    background: #ffffff;
    border-color: #ffffff;
    color: #075a77;
}

.logs-filters {
    align-items: end;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(150px, 190px) minmax(140px, 170px) 150px minmax(260px, 1fr) auto auto;
    margin-bottom: 12px;
}

.logs-filters label span {
    color: #d7edf7;
    font-size: 12px;
    margin-bottom: 4px;
}

.logs-filters input,
.logs-filters select,
.logs-filters button,
.logs-filters .button {
    height: 36px;
}

.table-wrap,
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
}

.modal-shell > .panel,
.modal-shell > .grid .panel,
.shell > .panel,
.shell > .grid .panel {
    background: #eef1f3;
    border-color: #c7d0d6;
    color: #071d2b;
}

.modal-shell > .panel h2,
.modal-shell > .grid .panel h2,
.shell > .panel h2,
.shell > .grid .panel h2,
.modal-shell > .panel h3,
.shell > .panel h3 {
    color: #071d2b;
}

.grid-window .table-wrap {
    border: 0;
    border-radius: 0;
}

.operational-table {
    max-height: calc(100vh - 300px);
    overflow: auto;
}

table {
    border-collapse: collapse;
    width: 100%;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 8px 12px;
    text-align: left;
    vertical-align: top;
}

td {
    color: #eef9ff;
}

th {
    background: var(--panel-strong);
    color: #ffffff;
    font-size: 12px;
    position: sticky;
    top: 0;
    text-transform: uppercase;
    z-index: 1;
}

.operational-table table {
    background: #e8ecef;
}

.operational-table td {
    background: #eef1f3;
    border-bottom: 1px solid #d3d9dd;
    border-right: 1px solid #d3d9dd;
    color: #061b2a;
    padding-bottom: 7px;
    padding-top: 7px;
}

.operational-table tbody tr:nth-child(even) td {
    background: #dfe4e7;
}

.operational-table td small {
    color: #4c626e;
}

.operational-table tbody tr:hover td,
.operational-table .client-row:hover td {
    background: #91bbcc;
    color: #061b2a;
}

.operational-table tr.highlight-courtesy td {
    background: #e9f2f6;
}

.operational-table tr.highlight-courtesy:hover td {
    background: #91bbcc;
}

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

.mono {
    font-family: Consolas, Monaco, monospace;
}

.nowrap {
    white-space: nowrap;
}

.pill {
    border-radius: 999px;
    display: inline-flex;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    padding: 6px 9px;
}

.operational-table .pill {
    font-size: 12px;
    justify-content: center;
    min-width: 58px;
    padding: 5px 9px;
}

.pill.success {
    background: var(--success-bg);
    color: var(--success);
}

.pill.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.pill.warning {
    background: #ffa51f;
    color: #102033;
}

.status-ixc-receber-button {
    border: 0;
    cursor: pointer;
}

.status-ixc-receber-button:disabled {
    cursor: wait;
    opacity: .75;
}

.confirm-overlay {
    align-items: center;
    background: rgba(3, 27, 40, .48);
    display: flex;
    inset: 0;
    justify-content: center;
    position: fixed;
    z-index: 1500;
}

.confirm-dialog {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 18px 50px rgba(0, 0, 0, .25);
    color: #102033;
    min-width: min(340px, calc(100vw - 32px));
    padding: 20px;
}

.confirm-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 18px;
}

.pill.neutral {
    background: #dde7ec;
    color: #102033;
}

.no-wrap,
.status-ixc-cell {
    white-space: nowrap;
}

.pill.courtesy {
    background: #18a8e8;
    color: #ffffff;
    margin-left: 6px;
}

tr.highlight-courtesy td {
    background: rgba(24, 168, 232, .12);
}

.client-row {
    cursor: pointer;
}

.client-row:hover td {
    background: rgba(24, 168, 232, .18);
}

.client-row.highlight-courtesy:hover td {
    background: rgba(24, 168, 232, .24);
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    background: rgba(24, 168, 232, .18);
}

.selected-row td {
    background: rgba(24, 168, 232, .3);
    color: #ffffff;
    font-weight: 700;
}

.selected-row td:first-child {
    box-shadow: inset 4px 0 0 var(--brand);
}

.courtesy-panel {
    border-color: rgba(24, 168, 232, .6);
    box-shadow: inset 4px 0 0 #18a8e8;
}

.row-action {
    border: 1px solid var(--line);
    border-radius: 6px;
    color: #075a77;
    background: #ffffff;
    display: inline-flex;
    height: 34px;
    font-weight: 700;
    line-height: 1;
    padding: 7px 10px;
}

.operational-table .row-action {
    background: #ffffff;
    border-color: #c9d4da;
    color: #075a77;
    height: 30px;
    padding: 5px 10px;
}

.operational-table .mono,
.operational-table strong {
    color: #071d2b;
}

.modal-open {
    overflow: hidden;
}

.client-modal {
    display: none;
    inset: 0;
    position: fixed;
    z-index: 30;
}

.client-modal.open {
    display: block;
}

.client-modal-backdrop {
    background: rgba(2, 30, 43, .72);
    inset: 0;
    position: absolute;
}

.client-modal-dialog {
    background: var(--panel);
    border-radius: 8px;
    bottom: 24px;
    box-shadow: 0 24px 80px rgba(6, 77, 123, .28);
    display: flex;
    flex-direction: column;
    left: 24px;
    overflow: hidden;
    position: absolute;
    right: 24px;
    top: 24px;
}

.client-modal-bar {
    align-items: center;
    border-bottom: 1px solid var(--line);
    background: var(--panel-strong);
    display: flex;
    justify-content: space-between;
    min-height: 52px;
    padding: 10px 16px;
}

.client-modal-close {
    height: 34px;
}

.client-modal iframe {
    border: 0;
    flex: 1;
    width: 100%;
}

.modal-page {
    background: var(--bg);
}

.modal-shell {
    max-width: none;
    padding: 20px;
}

.login-wrap {
    align-items: center;
    display: flex;
    justify-content: center;
    min-height: calc(100vh - 120px);
}

.login-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 18px 60px rgba(6, 77, 123, .12);
    display: grid;
    gap: 14px;
    padding: 24px;
    width: min(420px, 100%);
}

.login-card h1 {
    margin: 0;
}

.login-card p {
    color: var(--muted);
    margin: -6px 0 4px;
}

.login-card label span,
.user-form label span,
.user-row-form label span {
    color: #17384a;
}

.alert {
    border-radius: 6px;
    font-weight: 700;
    margin-bottom: 14px;
    padding: 12px 14px;
}

.alert.success {
    background: var(--success-bg);
    color: var(--success);
}

.alert.danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.user-form {
    align-items: flex-end;
    display: grid;
    gap: 14px;
    grid-template-columns: repeat(3, minmax(160px, 1fr)) auto auto;
}

.user-form.compact {
    grid-template-columns: minmax(220px, 360px) auto;
    margin-top: 18px;
}

.upload-form {
    align-items: flex-end;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(260px, 560px) auto;
    max-width: 760px;
}

.upload-form input[type="file"] {
    align-items: center;
    display: flex;
    padding: 8px 10px;
}

.radio-filter {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 12px 0 16px;
    overflow-x: auto;
}

.radio-filter label {
    align-items: center;
    background: #f8fbfd;
    border: 1px solid #bdd8e5;
    border-radius: 8px;
    color: #123247;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    font-weight: 700;
    gap: 8px;
    padding: 9px 12px;
    white-space: nowrap;
}

.radio-filter label span {
    color: #123247;
    display: inline;
    white-space: nowrap;
}

.radio-filter label:has(input:checked) {
    background: #e5f5fc;
    border-color: #1c8ead;
}

.radio-filter label:has(input:checked) span {
    color: #064b65;
}

.radio-filter input {
    accent-color: #1c8ead;
}

.return-metrics {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
}

.return-metrics .metric {
    background: #f8fbfd;
    color: #123247;
    min-width: 132px;
    padding: 10px 12px;
}

.return-metrics .metric span {
    font-size: 18px;
}

.return-metrics .metric small {
    color: #48697c;
}

.inline-action-form {
    margin: -4px 0 16px;
}

.inline-action-form button {
    width: auto;
}

.table-action-form {
    margin: 0;
}

.table-action-form button {
    height: 30px;
    padding: 0 10px;
}

.danger-button {
    background: var(--danger-bg);
    border-color: var(--danger-bg);
    color: var(--danger);
}

.import-search-form {
    align-items: flex-end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(280px, 1fr) auto auto;
    margin: 12px 0 16px;
}

.import-search-form label span {
    color: #123247;
    font-weight: 700;
}

.import-search-form input {
    background: #ffffff;
    border: 1px solid #bdd8e5;
    color: #061b2a;
    height: 38px;
}

.import-search-form button,
.import-search-form .button {
    height: 38px;
}

.nfcom-panel {
    padding: 18px;
}

.nfcom-filters {
    align-items: flex-end;
    display: grid;
    gap: 14px;
    grid-template-columns: minmax(280px, 1.4fr) minmax(170px, .6fr) minmax(190px, .7fr) minmax(190px, .7fr) auto auto;
    margin-bottom: 14px;
}

.nfcom-filters label span {
    color: #123247;
    font-weight: 700;
}

.nfcom-summary {
    align-items: baseline;
    color: #123247;
    display: flex;
    gap: 8px;
    margin: 2px 0 14px;
}

.nfcom-summary strong {
    font-size: 20px;
}

.nfcom-table {
    max-height: calc(100vh - 315px);
}

.small-button {
    height: 30px;
    padding: 0 10px;
}

.nfcom-danfe-print {
    color: #000;
    font-family: Arial, Helvetica, sans-serif;
}

.danfe-actions {
    margin: 0 auto 12px;
    max-width: 794px;
    text-align: right;
}

.danfe-sheet {
    background: #fff;
    color: #000;
    margin: 0 auto;
    min-height: 1123px;
    padding: 16px;
    width: 794px;
}

.danfe-sheet * {
    color: #000;
}

.danfe-header {
    align-items: stretch;
    background: #e5e5e5;
    display: grid;
    gap: 18px;
    grid-template-columns: 120px 1fr;
    padding: 10px 14px;
}

.danfe-logo {
    align-items: center;
    background: #fff;
    display: flex;
    justify-content: center;
    min-height: 104px;
    padding: 8px;
}

.danfe-logo img {
    display: block;
    max-height: 94px;
    max-width: 100%;
    object-fit: contain;
}

.danfe-emitente {
    display: grid;
    gap: 5px;
    font-size: 12px;
    font-weight: 700;
}

.danfe-emitente h2 {
    font-size: 12px;
    margin: 0 0 4px;
}

.danfe-main {
    display: grid;
    gap: 14px;
    grid-template-columns: 230px 136px 1fr;
    margin-top: 14px;
}

.danfe-destinatario,
.danfe-nota {
    display: grid;
    font-size: 14px;
    gap: 4px;
    font-weight: 400;
}

.danfe-client-name {
    display: block;
    font-size: 16px;
    font-weight: 400;
}

.danfe-nota strong {
    font-size: 14px;
    line-height: 1.2;
}

.danfe-nota span,
.danfe-nota strong {
    font-weight: 400;
}

.danfe-chave {
    display: block;
    font-size: 12px;
    letter-spacing: -0.2px;
    white-space: nowrap;
}

.danfe-qr {
    align-items: center;
    display: flex;
    justify-content: center;
}

.danfe-qr img {
    height: 128px;
    width: 128px;
}

.danfe-pills {
    display: flex;
    gap: 8px;
    margin: 18px 0 12px;
}

.danfe-pills span {
    background: #2d7d92;
    border-radius: 16px;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    padding: 6px 10px;
}

.danfe-pills span * {
    color: #fff;
}

.danfe-items,
.danfe-totals table {
    border-collapse: collapse;
    width: 100%;
}

.danfe-items {
    font-size: 11px;
}

.danfe-totals table {
    font-size: 10px;
}

.danfe-items th,
.danfe-items td,
.danfe-totals th,
.danfe-totals td {
    border: 1px solid #aaa;
    color: #000;
    padding: 3px 4px;
    vertical-align: top;
}

.danfe-items tbody tr:last-child td {
    border-bottom: 1px solid #aaa;
}

.danfe-items th,
.danfe-totals th,
.danfe-note h3,
.danfe-contrib h3 {
    background: #e5e5e5;
    font-weight: 700;
    text-align: center;
}

.danfe-items td:nth-child(3) {
    width: 250px;
}

.danfe-totals {
    display: grid;
    gap: 8px;
    grid-template-columns: 1.3fr 1fr 1fr;
    margin-top: 12px;
}

.danfe-totals td {
    text-align: right;
}

.danfe-totals table {
    border: 1px solid #aaa;
    table-layout: fixed;
}

.danfe-totals th,
.danfe-totals td {
    height: 19px;
    padding: 2px 5px;
}

.danfe-totals table:first-child th {
    background: #e5e5e5;
    font-size: 10px;
    text-align: left;
    white-space: nowrap;
    width: 70%;
}

.danfe-totals table:first-child td {
    width: 30%;
}

.danfe-totals tr:last-child th,
.danfe-totals tr:last-child td {
    border-bottom: 1px solid #aaa;
}

.danfe-totals table:not(:first-child) tr:first-child th,
.danfe-totals table:not(:first-child) tr:nth-child(2) th {
    text-align: center;
}

.danfe-totals table:not(:first-child) td:first-child {
    text-align: left;
}

.danfe-note {
    border: 1px solid #aaa;
    font-size: 10px;
    margin-top: 14px;
    min-height: 48px;
}

.danfe-note h3,
.danfe-contrib h3 {
    font-size: 11px;
    margin: 0;
    padding: 4px;
}

.danfe-note p,
.danfe-contrib p {
    margin: 5px;
}

.danfe-contrib {
    border: 1px solid #aaa;
    font-size: 10px;
    margin-top: 14px;
}

.danfe-contrib-head {
    border-bottom: 1px solid #aaa;
    display: grid;
    grid-template-columns: 1fr 1fr 2fr;
    padding: 7px 8px 5px;
}

.danfe-contrib-row {
    border-bottom: 1px solid #aaa;
    display: grid;
    grid-template-columns: .8fr 1fr 1fr 1fr 1fr 1fr;
    padding: 5px 8px 6px;
}

.danfe-contrib-head div,
.danfe-contrib-row div {
    display: grid;
    gap: 2px;
}

.danfe-contrib-head strong,
.danfe-contrib-row strong,
.danfe-instrucoes strong,
.danfe-line-row strong {
    font-size: 9px;
}

.danfe-contrib-head span,
.danfe-contrib-row span,
.danfe-instrucoes span,
.danfe-line-row span {
    font-weight: 700;
}

.danfe-instrucoes {
    display: grid;
    gap: 3px;
    min-height: 48px;
    padding: 8px;
}

.danfe-line-row {
    align-items: center;
    display: grid;
    gap: 8px;
    grid-template-columns: 105px 1fr;
    padding: 4px 8px;
}

.danfe-line-row span {
    font-size: 11px;
}

.danfe-barcode {
    display: block;
    height: 54px;
    max-width: 300px;
    width: 300px;
}

.danfe-anatel {
    background: #e5e5e5;
    margin-top: 14px;
    min-height: 42px;
    text-align: center;
}

.danfe-anatel h3 {
    font-size: 11px;
    margin: 0;
    padding: 10px;
}

@media print {
    .topbar,
    .danfe-actions {
        display: none;
    }

    body {
        background: #fff;
    }

    .shell {
        margin: 0;
        max-width: none;
        padding: 0;
    }

    .danfe-sheet {
        box-shadow: none;
        margin: 0;
        min-height: auto;
        padding: 0;
        width: 100%;
    }
}

.loading-overlay {
    align-items: center;
    background: rgba(4, 44, 61, .72);
    display: none;
    inset: 0;
    justify-content: center;
    position: fixed;
    z-index: 60;
}

.loading-overlay.show {
    display: flex;
}

.loading-card {
    align-items: center;
    background: #f8fbfd;
    border: 1px solid #bdd8e5;
    border-radius: 8px;
    box-shadow: 0 18px 48px rgba(0, 0, 0, .28);
    color: #123247;
    display: grid;
    gap: 8px;
    justify-items: center;
    min-width: 280px;
    padding: 24px 28px;
}

.loading-card small {
    color: #48697c;
}

.loading-card > strong:not(#loadingTitle),
.loading-card > small:not(#loadingDetail) {
    display: none;
}

.loading-copy {
    display: grid;
    gap: 4px;
    justify-items: center;
    text-align: center;
}

.loading-estimate {
    display: grid;
    gap: 7px;
    justify-items: center;
    min-width: min(360px, 78vw);
    text-align: center;
}

.loading-estimate span {
    font-weight: 700;
}

.loading-estimate progress {
    accent-color: #168db7;
    height: 12px;
    width: 100%;
}

.loading-spinner {
    border: 4px solid #d5e8f0;
    border-top-color: #168db7;
    border-radius: 999px;
    display: block;
    height: 38px;
    width: 38px;
    animation: spin .8s linear infinite;
}

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

.retorno-modal {
    display: none;
    inset: 0;
    position: fixed;
    z-index: 32;
}

.retorno-modal.open {
    display: block;
}

.retorno-modal-backdrop {
    background: rgba(2, 30, 43, .72);
    inset: 0;
    position: absolute;
}

.retorno-modal-dialog {
    background: #eef1f3;
    border-radius: 8px;
    bottom: 24px;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .28);
    display: flex;
    flex-direction: column;
    left: 20px;
    overflow: hidden;
    position: absolute;
    right: 20px;
    top: 20px;
}

.retorno-modal-bar {
    align-items: center;
    background: var(--panel-strong);
    border-bottom: 1px solid var(--line);
    color: #ffffff;
    display: flex;
    justify-content: space-between;
    min-height: 54px;
    padding: 10px 16px;
}

.retorno-modal-close {
    align-items: center;
    display: inline-flex;
    height: 34px;
}

.retorno-modal-body {
    overflow: auto;
    padding: 16px;
}

.retorno-modal-search {
    align-items: flex-end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(260px, 460px) auto auto;
    margin: 4px 0 16px;
    max-width: 760px;
}

.retorno-modal-search label span {
    color: #dce8ee;
    font-weight: 700;
}

.retorno-modal-search input {
    background: #ffffff;
    border: 1px solid #bdd8e5;
    color: #061b2a;
    height: 38px;
}

.retorno-modal-search button,
.retorno-modal-search .button {
    height: 38px;
}

.finance-search-form {
    align-items: end;
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(260px, 1fr) auto auto;
    margin: 14px 0 16px;
}

.finance-search-form label span {
    color: #15364a;
    display: block;
    font-size: 12px;
    font-weight: 800;
    margin-bottom: 6px;
}

.finance-search-form input {
    border: 1px solid #b7d6e5;
    border-radius: 6px;
    font-size: 14px;
    padding: 10px 12px;
    width: 100%;
}

.finance-search-form button,
.finance-search-form .button {
    min-width: 120px;
}

.finance-search-note {
    color: #15364a;
    font-size: 13px;
    font-weight: 800;
    margin: -6px 0 12px;
}

.retorno-result-panel {
    color: #ffffff;
    margin: 0;
}

.retorno-result-panel .section-title p,
.retorno-result-panel .muted {
    color: #dce8ee;
}

.retorno-result-panel .return-metrics .metric {
    background: #f8fbfd;
    color: #123247;
}

.clickable-row {
    cursor: pointer;
}

.clickable-row:hover td {
    background: #d8edf6;
}

.clickable-row.selected td {
    background: #bfe4f5;
    font-weight: 700;
}

.account-panel {
    max-width: 760px;
}

.user-row-form {
    align-items: center;
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(180px, 1fr) minmax(160px, 1fr) auto;
}

.user-row-form input {
    color: var(--surface-text);
}

.check {
    align-items: center;
    color: #17384a;
    display: inline-flex;
    font-weight: 700;
    gap: 8px;
    min-height: 40px;
}

.check input {
    height: auto;
    width: auto;
}

.actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.page-loading {
    align-items: center;
    background: rgba(2, 30, 43, .76);
    color: #ffffff;
    display: none;
    font-weight: 700;
    gap: 12px;
    inset: 0;
    justify-content: center;
    position: fixed;
    z-index: 40;
}

.page-loading.show {
    display: flex;
}

.loader {
    animation: spin .8s linear infinite;
    border: 3px solid #cfe7fb;
    border-top-color: var(--brand);
    border-radius: 50%;
    height: 28px;
    width: 28px;
}

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

.pagination {
    align-items: center;
    display: flex;
    gap: 14px;
    justify-content: flex-end;
    margin-top: 16px;
}

.pagination a {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 6px;
    color: #ffffff;
    font-weight: 700;
    padding: 9px 12px;
}

.pagination a.disabled {
    color: #a0aab8;
    pointer-events: none;
}

.grid {
    display: grid;
    gap: 18px;
    margin-bottom: 18px;
}

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

.panel {
    margin-bottom: 18px;
    padding: 18px;
}

.panel h2 {
    font-size: 18px;
    margin: 0 0 14px;
}

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

.facts div {
    border-top: 1px solid var(--line);
    padding-top: 10px;
}

.facts dt {
    color: #42606d;
    font-size: 12px;
    font-weight: 700;
    margin-bottom: 4px;
}

.facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.address,
.muted {
    color: #4c626e;
    line-height: 1.6;
}

.notes {
    background: #ffffff;
    border: 1px solid var(--line);
    color: #071d2b;
    border-radius: 6px;
    line-height: 1.5;
    max-height: 280px;
    overflow: auto;
    padding: 12px;
    white-space: pre-wrap;
}

.notes-courtesy {
    background: rgba(24, 168, 232, .12);
    border-color: rgba(24, 168, 232, .6);
    box-shadow: inset 4px 0 0 var(--brand);
}

.mini-table {
    overflow-x: auto;
}

.mini-table th .sort-link {
    align-items: center;
    color: inherit;
    display: inline-flex;
    gap: 4px;
    white-space: nowrap;
}

.mini-table th .sort-link span {
    color: #c8eefc;
    font-size: 11px;
}

.mini-table th .sort-link.active span {
    color: #ffffff;
}

.panel .mini-table table {
    background: #e8ecef;
}

.panel .mini-table td {
    background: #eef1f3;
    border-bottom: 1px solid #d3d9dd;
    border-right: 1px solid #d3d9dd;
    color: #061b2a;
    padding-bottom: 7px;
    padding-top: 7px;
}

.panel .mini-table tbody tr:nth-child(even) td {
    background: #dfe4e7;
}

.panel .mini-table tbody tr:hover td {
    background: #91bbcc;
}

.client-copy-cell {
    align-items: center;
    display: flex;
    gap: 8px;
    justify-content: space-between;
    min-width: 220px;
}

.copy-client-button {
    align-items: center;
    background: #f7fbfd;
    border: 1px solid #b7d6e5;
    border-radius: 6px;
    color: #075b74;
    cursor: pointer;
    display: inline-flex;
    flex: 0 0 auto;
    height: 28px;
    justify-content: center;
    padding: 0;
    width: 28px;
}

.copy-client-button:hover,
.copy-client-button.copied {
    background: #21c063;
    border-color: #21c063;
    color: #ffffff;
}

.copy-client-button.copy-error {
    background: #ff4b45;
    border-color: #ff4b45;
    color: #ffffff;
}

.copy-client-button svg {
    fill: none;
    height: 16px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 16px;
}

.obs-cell {
    min-width: 56px;
    text-align: center;
}

.retorno-obs-button {
    align-items: center;
    background: #f7fbfd;
    border: 1px solid #b7d6e5;
    border-radius: 6px;
    color: #075b74;
    cursor: pointer;
    display: inline-flex;
    height: 30px;
    justify-content: center;
    padding: 0;
    width: 34px;
}

.retorno-obs-button.has-obs {
    background: #fff4c2;
    border-color: #f0a51b;
    color: #7b4d00;
}

.retorno-obs-button:hover {
    background: #21a7d3;
    border-color: #21a7d3;
    color: #ffffff;
}

.retorno-obs-button svg {
    fill: none;
    height: 17px;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 2;
    width: 17px;
}

.obs-modal {
    display: none;
}

.obs-modal.open {
    display: block;
}

.obs-modal-backdrop {
    background: rgba(0, 31, 43, 0.58);
    inset: 0;
    position: fixed;
    z-index: 3000;
}

.obs-modal-dialog {
    background: #ffffff;
    border-radius: 8px;
    box-shadow: 0 18px 60px rgba(0, 0, 0, 0.25);
    left: 50%;
    max-width: 520px;
    padding: 18px;
    position: fixed;
    top: 50%;
    transform: translate(-50%, -50%);
    width: min(92vw, 520px);
    z-index: 3001;
}

.obs-modal-dialog h3 {
    color: #061b2a;
    margin: 0 0 12px;
}

.obs-modal-dialog textarea {
    border: 1px solid #b7d6e5;
    border-radius: 6px;
    color: #061b2a;
    font-size: 14px;
    min-height: 160px;
    padding: 10px;
    resize: vertical;
    width: 100%;
}

.obs-modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 14px;
}

.ixc-count-badge {
    color: #0b4157;
    display: inline-block;
    font-size: 12px;
    font-weight: 800;
    margin-left: 8px;
    white-space: nowrap;
}

.search-match {
    background: #fff176;
    border-radius: 3px;
    box-shadow: inset 0 -2px 0 rgba(180, 135, 0, .35);
    color: #061b2a;
    font-weight: 800;
    padding: 0 2px;
}

.pagination {
    align-items: center;
    color: #123247;
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    margin-top: 12px;
}

.importacoes-pagination a {
    align-items: center;
    background: #eef1f3;
    border: 1px solid #bdd8e5;
    border-radius: 4px;
    color: #123247;
    display: inline-flex;
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
    font-weight: 900;
    height: 28px;
    justify-content: center;
    line-height: 1;
    min-width: 28px;
    padding: 0 6px;
    text-decoration: none;
}

.importacoes-pagination a:hover {
    background: #d8edf6;
}

.importacoes-pagination a.disabled {
    color: #8ba0aa;
    opacity: .55;
    pointer-events: none;
}

.pagination span {
    margin: 0 6px;
    font-weight: 700;
}

.retorno-result-panel .pagination {
    color: #dce8ee;
}

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

.back {
    display: inline-block;
    font-weight: 700;
    margin-bottom: 14px;
}

.tabs {
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 8px;
    margin: -4px 0 18px;
    overflow-x: auto;
}

.detail-tabs {
    background: #5f7075;
    border: 1px solid rgba(255, 255, 255, .16);
    border-top: 0;
    margin: 0 0 18px;
    padding: 0 12px;
}

.tabs a {
    border: 1px solid transparent;
    border-radius: 8px 8px 0 0;
    color: #bde9fb;
    font-weight: 700;
    padding: 12px 16px;
    white-space: nowrap;
}

.detail-tabs a {
    border-radius: 6px 6px 0 0;
    color: #ffffff;
    padding: 11px 15px;
}

.tabs a.active {
    background: var(--panel);
    border-color: var(--line);
    border-bottom-color: var(--panel);
    color: #ffffff;
    margin-bottom: -1px;
}

.detail-tabs a.active {
    background: #eef1f3;
    border-color: #c7d0d6;
    border-bottom-color: #eef1f3;
    color: #075a77;
}

.subtabs {
    display: flex;
    gap: 8px;
    margin: 0 0 16px;
}

.subtabs a {
    border: 1px solid var(--line);
    border-radius: 6px;
    color: #075a77;
    font-weight: 700;
    padding: 9px 12px;
}

.subtabs a.active {
    background: #18a8e8;
    border-color: #18a8e8;
    color: #ffffff;
}

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

.section-title h2 {
    margin-bottom: 4px;
}

.section-title p {
    color: #486270;
    font-weight: 600;
    margin: 0;
}

.facts.four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.contract-card {
    overflow: visible;
}

.contract-attachments {
    border-top: 1px solid var(--line);
    margin-top: 16px;
    padding-top: 14px;
}

.contract-attachments h3 {
    color: var(--surface-text);
    font-size: 14px;
    margin: 0 0 10px;
}

.attachment-path {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    display: grid;
    grid-template-columns: minmax(0, .72fr) 34px minmax(260px, .55fr);
    gap: 6px;
    padding: 10px 12px;
}

.attachment-path + .attachment-path {
    margin-top: 8px;
}

.attachment-path span {
    color: #486270;
    display: block;
    font-size: 12px;
    font-weight: 700;
    grid-column: 1;
    margin-bottom: 6px;
}

.attachment-path code {
    color: #0b2433;
    font-size: 13px;
    grid-column: 1;
    overflow-wrap: anywhere;
    white-space: normal;
}

.attachment-path .icon-button {
    grid-column: 2;
    grid-row: 1 / span 2;
    justify-self: end;
}

.attachment-path.muted code,
.attachment-path.muted span {
    color: #6b7f8b;
}

.icon-button {
    align-items: center;
    background: #18a8e8;
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    display: inline-flex;
    flex: 0 0 auto;
    font-size: 16px;
    font-weight: 800;
    height: 34px;
    justify-content: center;
    line-height: 1;
    padding: 0;
    width: 34px;
}

.download-link {
    cursor: pointer;
    text-decoration: none;
}

.download-link:hover {
    background: #0b8fcb;
}

.notes.small {
    margin-top: 16px;
    max-height: 180px;
}

.detail-notes {
    margin-top: 18px;
}

.highlight-info {
    background: #dfeaf0;
    border: 1px solid var(--line);
    border-radius: 8px;
    margin-top: 18px;
    padding: 16px;
}

.highlight-info .section-title {
    margin-bottom: 10px;
}

.highlight-info .notes {
    background: #ffffff;
    margin: 0;
    max-height: none;
}

.detail-notes h3 {
    font-size: 14px;
    margin: 0 0 8px;
}

.timeline {
    border-top: 1px solid var(--line);
    margin-top: 18px;
    padding-top: 18px;
}

.timeline h3 {
    font-size: 16px;
    margin: 0 0 12px;
}

.timeline-item {
    border-bottom: 1px solid var(--line);
    padding: 12px 0;
}

.timeline-item:last-child {
    border-bottom: 0;
}

.timeline-head {
    align-items: center;
    display: flex;
    gap: 12px;
    justify-content: space-between;
    margin-bottom: 8px;
}

.timeline-head span {
    color: var(--muted);
    font-size: 12px;
}

@media (max-width: 900px) {
    .shell {
        padding: 18px;
    }

    .page-head,
    .toolbar,
    .section-title {
        display: block;
    }

    .toolbar > * {
        margin-bottom: 12px;
    }

    .upload-form,
    .import-search-form,
    .finance-search-form,
    .nfcom-filters,
    .logs-filters,
    .retorno-modal-search {
        grid-template-columns: 1fr;
    }

    .return-metrics {
        justify-content: flex-start;
        margin-top: 12px;
    }

    .grid.two,
    .facts.four,
    .facts {
        grid-template-columns: 1fr;
    }

    .table-wrap {
        overflow-x: auto;
    }
}
