:root {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: #172033;
    background: #f5f7fb;
    line-height: 1.5;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
a { color: #143d78; }
.container { width: min(1120px, calc(100% - 32px)); margin: 0 auto; }
.has-sidebar {
    --sidebar-width: 276px;
    --sidebar-collapsed-width: 80px;
    padding-left: var(--sidebar-width);
    transition: padding-left .25s ease;
}
.has-sidebar.sidebar-collapsed { padding-left: var(--sidebar-collapsed-width); }
.sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 40;
    width: var(--sidebar-width); padding: 18px 12px;
    display: flex; flex-direction: column;
    background: #021f4e; color: white;
    box-shadow: 4px 0 18px rgba(2, 31, 78, .16);
    transition: width .25s ease, transform .25s ease;
}
.sidebar-header {
    min-height: 48px; display: flex; align-items: center;
    justify-content: space-between; gap: 8px; margin-bottom: 22px;
}
.brand { color: white; text-decoration: none; font-weight: 700; display: inline-flex; align-items: center; gap: 10px; }
.brand-logo { width: 38px; height: 38px; border-radius: 8px; object-fit: cover; flex: 0 0 auto; }
.sidebar .brand { min-width: 0; overflow: hidden; padding-left: 9px; white-space: nowrap; }
.sidebar-toggle, .mobile-menu-toggle {
    width: 42px; height: 42px; flex: 0 0 42px;
    display: inline-flex; align-items: center; justify-content: center;
    border: 0; border-radius: 9px; color: white;
    background: rgba(255, 255, 255, .1); font: inherit; cursor: pointer;
}
.sidebar-toggle:hover, .mobile-menu-toggle:hover { background: rgba(255, 255, 255, .18); }
.toggle-icon { font-size: 1.8rem; line-height: 1; transition: transform .25s ease; }
.sidebar-nav { display: flex; flex: 1; flex-direction: column; gap: 6px; min-height: 0; }
.sidebar-nav a, .sidebar-nav .link-button {
    width: 100%; color: white; text-decoration: none;
    display: flex; align-items: center; min-height: 50px;
}
.nav-link { padding: 0 14px; border-radius: 9px; font-weight: 600; overflow: hidden; white-space: nowrap; }
.nav-link:hover { background: rgba(255, 255, 255, 0.1); }
.nav-link.active { background: rgba(255, 255, 255, 0.18); box-shadow: inset 3px 0 #72aaf0; }
.nav-icon {
    width: 28px; flex: 0 0 28px; display: inline-flex;
    align-items: center; justify-content: center;
    font-size: 1.35rem; line-height: 1; font-weight: 700;
}
.nav-icon-plus { font-size: 1.55rem; }
.nav-label {
    margin-left: 12px; overflow: hidden; text-overflow: ellipsis;
    opacity: 1; transition: opacity .15s ease;
}
.brand-label { margin-left: 0; }
.sidebar-logout { margin-top: auto; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .14); }
.inline { display: inline; }
.link-button, .danger-link { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.sidebar-nav .link-button { color: white; padding: 0 14px; border-radius: 9px; font-weight: 600; }
.link-button:hover { background: rgba(255, 255, 255, 0.1); }
.sidebar-collapsed .sidebar { width: var(--sidebar-collapsed-width); }
.sidebar-collapsed .sidebar-header { justify-content: center; }
.sidebar-collapsed .sidebar .brand { display: none; }
.sidebar-collapsed .sidebar-toggle .toggle-icon { transform: rotate(180deg); }
.sidebar-collapsed .sidebar .nav-label { opacity: 0; width: 0; margin-left: 0; pointer-events: none; }
.sidebar-collapsed .sidebar .nav-link,
.sidebar-collapsed .sidebar-nav .link-button { justify-content: center; padding-inline: 12px; }
.sidebar-collapsed .sidebar .nav-link.active { box-shadow: none; outline: 2px solid rgba(114, 170, 240, .7); }
.mobile-header, .sidebar-backdrop { display: none; }
.guest-header { background: #021f4e; color: white; padding: 16px 0; }
.guest-header-content { display: flex; align-items: center; }
.danger-link { color: #a21b1b; text-decoration: underline; display: inline-flex; align-items: center; min-height: 48px; }
main { padding: 32px 0 64px; }
h1, h2 { line-height: 1.2; }
.card { background: white; border: 1px solid #dfe5ef; border-radius: 10px; padding: 24px; margin-bottom: 24px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06); }
.narrow { max-width: 460px; margin: 48px auto; }
.form-card { max-width: 700px; }
.muted { color: #5e6879; }
.page-header, .section-title { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 24px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric { background: white; border: 1px solid #dfe5ef; border-radius: 10px; padding: 20px; }
.metric strong { display: block; font-size: 2rem; }
.metric span { color: #5e6879; }
.field { margin-bottom: 18px; }
.field label { display: block; font-weight: 650; margin-bottom: 6px; }
.field input, .field select, .field textarea { width: 100%; min-height: 48px; padding: 11px 12px; border: 1px solid #aeb8c8; border-radius: 6px; font: inherit; }
.field textarea { min-height: 110px; resize: vertical; }
.field input[type="file"] { padding: 10px 0; border: none; }
.checkbox-field { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: start; margin: 20px 0; }
.checkbox-group { border: 1px solid #dfe5ef; border-radius: 10px; padding: 16px; margin: 12px 0 20px; }
.checkbox-group legend { font-weight: 650; padding: 0 6px; }
.checkbox-option { display: flex; align-items: center; gap: 10px; padding: 10px 0; min-height: 48px; cursor: pointer; }
.checkbox-option input { width: 20px; height: 20px; flex-shrink: 0; }
.button {
    display: inline-flex; align-items: center; justify-content: center;
    min-height: 48px; border: 0; border-radius: 6px; background: #143d78; color: white;
    padding: 12px 18px; font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
}
.button.small { padding: 8px 16px; font-size: .9rem; }
.button.ghost { background: white; color: #143d78; border: 1px solid #143d78; }
.full { width: 100%; }
.hint { color: #5e6879; display: block; margin-top: 6px; font-size: .85rem; }
.visually-hidden {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}
.error { color: #a21b1b; display: block; margin-top: 4px; font-size: .9rem; }
.auth-actions { margin: 18px 0 0; text-align: center; }
.auth-actions a { color: #143d78; font-weight: 600; }
.field-hint { display: block; margin-top: 4px; font-size: .9rem; }
.alert { padding: 12px 14px; border-radius: 6px; margin-bottom: 16px; }
.alert-success { background: #e8f7ee; border: 1px solid #8ac8a1; }
.alert-error { background: #fff0f0; border: 1px solid #d9a0a0; }
.confirmation-dialog {
    width: min(480px, calc(100% - 32px)); padding: 0;
    border: 0; border-radius: 12px; color: #172033;
    box-shadow: 0 18px 50px rgba(2, 31, 78, 0.28);
}
.confirmation-dialog::backdrop { background: rgba(2, 15, 36, 0.58); }
.confirmation-dialog-content { padding: 24px; }
.confirmation-dialog h2 { margin: 0 0 12px; }
.confirmation-dialog p { margin: 0; color: #4f5b6e; white-space: pre-line; }
.confirmation-dialog-actions {
    display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px;
}
.button.confirmation-danger { background: #a21b1b; }
.button.confirmation-danger:hover { background: #821515; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid #e4e8ef; white-space: nowrap; }
th { font-size: .85rem; color: #5e6879; }
.status { display: inline-block; padding: 3px 8px; border-radius: 999px; background: #e8edf5; font-size: .85rem; }
.status-sent { background: #dff4e7; }
.status-dead, .status-cancelled { background: #f5dfdf; }
.status-processing { background: #fff0c9; }
.status-paid { background: #dff4e7; color: #155c31; }
.status-canceled { background: #f5dfdf; color: #7f1d1d; }
.status-overdue { background: #ffe0dd; color: #8a1c13; }
.status-partial_paid { background: #fff0c9; color: #6b4b00; }
.status-negotiating { background: #e6e2ff; color: #43308f; }
.status-pending { background: #e8edf5; color: #27364f; }
.status-approved { background: #dff4e7; color: #155c31; }
.status-closed { background: #dcecff; color: #174d83; }
.status-reversed { background: #f5dfdf; color: #7f1d1d; }
.status-emitido { background: #dcecff; color: #174d83; }
.status-pago { background: #dff4e7; color: #155c31; }
.status-cancelado, .status-baixado { background: #f5dfdf; color: #7f1d1d; }
.status-vencido { background: #ffe0dd; color: #8a1c13; }
.status-pendente { background: #e8edf5; color: #27364f; }
.code-value { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .02em; }
.pagination { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 10px; padding: 18px 0; }
.pagination-top { padding-top: 0; border-bottom: 1px solid #e4e8ef; margin-bottom: 16px; }
.pagination-bottom { padding-bottom: 0; border-top: 1px solid #e4e8ef; margin-top: 16px; }
.pagination-pages { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; }
.pagination-link { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; min-height: 42px; padding: 8px 12px; border: 1px solid #cbd4e2; border-radius: 8px; background: white; color: #143d78; font-weight: 650; line-height: 1; text-decoration: none; }
a.pagination-link:hover { background: #edf3fb; border-color: #143d78; }
.pagination-link.active { background: #143d78; border-color: #143d78; color: white; }
.pagination-link.disabled { color: #8791a2; background: #f2f4f7; cursor: not-allowed; }
.pagination-edge { min-width: 70px; }
.pagination-ellipsis { padding: 0 3px; color: #5e6879; font-weight: 700; }

.welcome-banner {
    background: white; border: 1px solid #dfe5ef; border-radius: 10px;
    padding: 20px 24px; margin-bottom: 24px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.welcome-banner p { margin: 0; font-size: 1.1rem; font-weight: 650; }

.search-bar { display: flex; gap: 10px; margin-bottom: 20px; }
.search-bar input[type="search"] {
    flex: 1; min-height: 48px; padding: 11px 14px; border: 1px solid #aeb8c8;
    border-radius: 6px; font: inherit;
}

.thumb {
    width: 56px; height: 56px; border-radius: 8px; object-fit: cover;
    display: inline-flex; align-items: center; justify-content: center;
    background: #e8edf5; color: #5e6879; font-size: .85rem;
}
.thumb-preview { width: 120px; height: 120px; margin-bottom: 10px; }

.stock-cell { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.badge-low-stock {
    display: inline-block; padding: 3px 8px; border-radius: 999px;
    background: #fff0c9; color: #6b4b00; font-size: .8rem; font-weight: 650;
}
.qty-display { font-weight: 650; min-width: 2ch; }
.stock-form { display: flex; gap: 8px; margin-top: 10px; align-items: center; flex-wrap: wrap; }
.stock-form[hidden] { display: none; }
.stock-form input[type="number"] {
    width: 100px; min-height: 48px; padding: 10px 12px; border: 1px solid #aeb8c8;
    border-radius: 6px; font: inherit;
}

.row-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.filter-grid {
    display: grid; grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(150px, 1fr)) auto;
    gap: 12px; align-items: end; margin-bottom: 24px;
}
.commission-filter-grid {
    grid-template-columns: repeat(2, minmax(190px, 1fr)) auto;
}
.filter-grid .field { margin-bottom: 0; }
.filter-actions { display: flex; gap: 8px; align-items: center; }
.debts-filter-grid {
    grid-template-columns:
        minmax(240px, 2fr)
        minmax(160px, 1fr)
        repeat(2, minmax(190px, 1fr));
}
.debts-filter-grid .field label { white-space: nowrap; }
.debts-filter-grid .filter-actions {
    grid-column: 1 / -1;
    justify-content: flex-end;
}
.details-grid {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px; margin: 0;
}
.details-grid div { min-width: 0; }
.details-grid dt { color: #5e6879; font-size: .85rem; font-weight: 650; }
.details-grid dd { margin: 4px 0 0; overflow-wrap: anywhere; }
.details-grid .details-wide { grid-column: 1 / -1; }
.payable-filter-grid { grid-template-columns: minmax(220px, 1.5fr) repeat(3, minmax(150px, 1fr)) auto; }
.payable-form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.payable-form-grid .field-wide { grid-column: 1 / -1; }
.page-eyebrow {
    display: block; margin-bottom: 5px; color: #42638f; font-size: .72rem;
    font-weight: 800; letter-spacing: .09em; text-transform: uppercase;
}
.payable-page-header h1 { margin: 0 0 6px; }
.payable-page-header p { margin: 0; }
.finance-dashboard { margin-bottom: 28px; }
.finance-dashboard-header {
    display: flex; align-items: center; justify-content: space-between; gap: 18px;
    margin-bottom: 16px;
}
.finance-dashboard-header h2 { margin: 0; font-size: 1.55rem; }
.finance-dashboard-header p { margin: 5px 0 0; color: #5e6879; }
.month-navigation { display: flex; align-items: center; gap: 8px; }
.month-navigation a {
    min-width: 42px; min-height: 42px; padding: 8px 12px; display: inline-flex;
    align-items: center; justify-content: center; border: 1px solid #cbd4e2;
    border-radius: 9px; background: white; color: #143d78; font-weight: 750;
    text-decoration: none; box-shadow: 0 1px 2px rgba(2, 31, 78, .06);
}
.month-navigation a:hover { border-color: #143d78; background: #f1f6fc; }
.month-navigation .month-current { min-width: auto; font-size: .86rem; }
.finance-kpi-grid {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px; margin-bottom: 14px;
}
.finance-kpi {
    min-width: 0; padding: 19px; border: 1px solid #dce4ef; border-radius: 14px;
    background: white; box-shadow: 0 4px 15px rgba(2, 31, 78, .055);
}
.finance-kpi-heading { display: flex; align-items: center; gap: 9px; color: #536176; font-size: .86rem; font-weight: 700; }
.finance-kpi-icon {
    width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px;
    background: #e8f0fb; color: #143d78; font-size: .72rem; font-weight: 850;
}
.finance-kpi strong { display: block; margin-top: 14px; font-size: clamp(1.4rem, 2.1vw, 2rem); line-height: 1.05; letter-spacing: -.03em; }
.finance-kpi p { margin: 8px 0 0; color: #6a7586; font-size: .82rem; }
.finance-kpi-pending { border-top: 3px solid #315f9e; }
.finance-kpi-paid { border-top: 3px solid #278452; }
.finance-kpi-paid .finance-kpi-icon { background: #e2f5e9; color: #17633a; }
.finance-kpi-whatsapp { border-top: 3px solid #20a866; }
.finance-kpi-whatsapp .finance-kpi-icon { background: #ddf7e9; color: #147242; }
.finance-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(290px, .85fr); gap: 14px; margin-bottom: 14px; }
.finance-panel {
    min-width: 0; padding: 22px; border: 1px solid #dce4ef; border-radius: 14px;
    background: white; box-shadow: 0 4px 15px rgba(2, 31, 78, .05);
}
.finance-panel-title { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.finance-panel-title h3 { margin: 0; font-size: 1.08rem; }
.finance-panel-title > strong { color: #17633a; font-size: 1.5rem; }
.finance-progress { width: 100%; height: 12px; border: 0; border-radius: 999px; overflow: hidden; background: #e8edf5; }
.finance-progress::-webkit-progress-bar { background: #e8edf5; border-radius: 999px; }
.finance-progress::-webkit-progress-value { background: #278452; border-radius: 999px; }
.finance-progress::-moz-progress-bar { background: #278452; border-radius: 999px; }
.finance-progress-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 22px; margin-top: 14px; }
.finance-progress-legend div { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; font-size: .86rem; color: #5e6879; }
.finance-progress-legend strong { color: #172033; }
.legend-dot { width: 9px; height: 9px; border-radius: 50%; }
.legend-paid { background: #278452; }
.legend-pending { background: #b7c2d1; }
.finance-alert-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 22px; padding-top: 20px; border-top: 1px solid #e7ebf1; }
.finance-alert { padding: 14px; border-radius: 10px; background: #f5f7fb; }
.finance-alert > span, .finance-alert small { display: block; color: #667286; font-size: .78rem; }
.finance-alert strong { display: block; margin: 4px 0; }
.finance-alert-danger { background: #fff0ef; }
.finance-alert-danger > span, .finance-alert-danger strong { color: #8a1c13; }
.finance-alert-ok { background: #eaf7ef; }
.finance-alert-ok > span, .finance-alert-ok strong { color: #17633a; }
.finance-alert-upcoming { background: #eef4fb; }
.finance-count-badge { min-width: 32px; padding: 5px 9px; border-radius: 999px; background: #ddf7e9; color: #147242; font-size: .82rem; font-weight: 800; text-align: center; }
.finance-compact-list { list-style: none; padding: 0; margin: 0; }
.finance-compact-list li { border-top: 1px solid #e7ebf1; }
.finance-compact-list li:first-child { border-top: 0; }
.finance-compact-list a { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; color: #172033; text-decoration: none; }
.finance-compact-list a:hover strong { color: #143d78; }
.finance-compact-list span:first-child { min-width: 0; }
.finance-compact-list strong, .finance-compact-list small { display: block; }
.finance-compact-list span:first-child strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .88rem; }
.finance-compact-list small { margin-top: 3px; color: #6a7586; }
.finance-list-value { flex: 0 0 auto; font-weight: 750; font-size: .86rem; }
.finance-empty-compact { min-height: 155px; display: grid; place-items: center; align-content: center; text-align: center; color: #5e6879; }
.finance-empty-compact > span { width: 42px; height: 42px; display: grid; place-items: center; margin-bottom: 10px; border-radius: 50%; background: #e8edf5; color: #52637a; font-size: .74rem; font-weight: 850; }
.finance-empty-compact p { max-width: 260px; margin: 5px 0 0; font-size: .84rem; }
.finance-schedule-panel { padding-bottom: 8px; }
.finance-text-link { color: #143d78; font-size: .86rem; font-weight: 750; text-decoration: none; }
.finance-schedule-list { border-top: 1px solid #e7ebf1; }
.finance-schedule-row {
    display: grid; grid-template-columns: 58px minmax(220px, 1fr) auto auto auto;
    align-items: center; gap: 16px; min-height: 76px; padding: 10px 4px;
    border-bottom: 1px solid #e7ebf1; color: #172033; text-decoration: none;
}
.finance-schedule-row:hover { background: #f8fafd; }
.finance-schedule-row time { width: 50px; min-height: 50px; display: grid; place-items: center; align-content: center; border-radius: 10px; background: #eef4fb; color: #143d78; line-height: 1; }
.finance-schedule-row time strong { font-size: 1.18rem; }
.finance-schedule-row time span { margin-top: 3px; font-size: .68rem; }
.finance-supplier { min-width: 0; }
.finance-supplier strong, .finance-supplier small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.finance-supplier small { margin-top: 3px; color: #6a7586; }
.finance-notification-state { color: #6a7586; font-size: .78rem; }
.finance-notification-state.is-sent { color: #147242; font-weight: 700; }
.finance-schedule-value { text-align: right; white-space: nowrap; }
.finance-empty-schedule { padding: 30px 12px 38px; text-align: center; color: #5e6879; border-top: 1px solid #e7ebf1; }
.finance-empty-schedule p { margin: 5px 0 0; }
.payable-list-title h2 { margin: 0 0 4px; }
.payable-list-title p { margin: 0; }
.receivable-sequence-card { border-top: 3px solid #f0cf1b; }
.receivable-sequence-card .finance-kpi-icon { background: #fff7bf; color: #654f00; }
.receivable-sequence-card strong { color: #0b3270; letter-spacing: .04em; }
.hint-inline { color: #788396; font-size: .74rem; }
.receivable-filter-grid {
    grid-template-columns: minmax(210px, 1.4fr) repeat(3, minmax(155px, 1fr));
}
.receivable-filter-grid .filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
.status-parcial { background: #fff0c9; color: #6b4b00; }
.receivable-consent-field { align-self: center; }
.field.checkbox-field { display: block; }
.field.checkbox-field label { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; }
.field.checkbox-field input[type="checkbox"] {
    flex: 0 0 20px; width: 20px; min-height: 20px; height: 20px; margin-top: 2px;
}
.receivable-preview-table td:first-child { max-width: 240px; overflow-wrap: anywhere; white-space: normal; }
.receivable-groups-table th, .receivable-groups-table td,
.receivable-installments-table th, .receivable-installments-table td { padding-left: 8px; padding-right: 8px; }
.receivable-groups-table th:last-child, .receivable-groups-table td:last-child,
.receivable-installments-table th:last-child, .receivable-installments-table td:last-child {
    position: sticky; right: 0; z-index: 1; background: white;
    box-shadow: -8px 0 12px rgba(2, 31, 78, .06);
}
.receivable-groups-table th:last-child,
.receivable-installments-table th:last-child { background: #f8fafc; }
.receivable-contact-card { margin-bottom: 24px; }
.receivable-contact-form {
    display: grid; grid-template-columns: minmax(220px, 1fr) minmax(300px, 1.4fr) auto;
    align-items: center; gap: 16px;
}
.receivable-contact-form .field { margin: 0; }
.receivable-contact-form .button { align-self: end; }
.receivable-detail-header-actions { display: flex; align-items: center; gap: 12px; }
.receivable-detail-header-actions form { margin: 0; }
.receivable-installments-section { margin-top: 28px; }
.receivable-installment-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px;
}
.receivable-installment-card {
    min-width: 0; overflow: hidden; border: 1px solid #dce4ef; border-radius: 14px;
    background: white; box-shadow: 0 4px 14px rgba(2, 31, 78, .06);
}
.receivable-installment-header {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 18px 20px; border-bottom: 1px solid #e8edf4; background: #f8fafc;
}
.receivable-installment-header > div { display: flex; align-items: baseline; gap: 8px; }
.receivable-installment-header strong { color: #0b3270; font-size: 1.22rem; }
.receivable-installment-kicker { color: #6a7586; font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.receivable-installment-main { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 20px; }
.receivable-installment-main span, .receivable-installment-data dt { display: block; margin-bottom: 5px; color: #6a7586; font-size: .76rem; font-weight: 650; }
.receivable-installment-main strong { color: #172033; font-size: 1.12rem; }
.receivable-installment-value { text-align: right; }
.receivable-installment-value strong { color: #0b3270; font-size: 1.28rem; }
.receivable-installment-data { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin: 0 20px; border: 1px solid #e5eaf1; border-radius: 10px; overflow: hidden; }
.receivable-installment-data > div { min-width: 0; padding: 12px 14px; border-bottom: 1px solid #e5eaf1; }
.receivable-installment-data > div:nth-child(odd) { border-right: 1px solid #e5eaf1; }
.receivable-installment-data > div:nth-last-child(-n+2) { border-bottom: 0; }
.receivable-installment-data dd { margin: 0; color: #26344a; font-size: .84rem; overflow-wrap: anywhere; }
.receivable-installment-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 18px 20px 20px; }
.receivable-installment-actions form { margin: 0; }
.receivable-installments-table td { vertical-align: middle; }
.receivable-row-actions { display: flex; align-items: center; gap: 8px; }
.receivable-row-actions form { margin: 0; }
.qr-dialog {
    width: min(620px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 14px;
    color: #172033; box-shadow: 0 20px 60px rgba(2, 31, 78, .28);
}
.qr-dialog::backdrop { background: rgba(2, 15, 36, .62); }
.qr-dialog-content { padding: 24px; }
.qr-dialog-content img {
    display: block; width: min(360px, 100%); height: auto; margin: 0 auto 20px;
    border: 1px solid #dfe5ef; border-radius: 10px;
}
.qr-dialog-content .field { margin-bottom: 0; }
.qr-dialog-content textarea { margin-bottom: 10px; font-size: .78rem; overflow-wrap: anywhere; }
.step-heading { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; }
.step-heading > span { display: grid; place-items: center; flex: 0 0 34px; height: 34px; border-radius: 50%; background: #143d78; color: white; font-weight: 750; }
.step-heading h2 { margin: 1px 0 4px; }
.step-heading p { margin: 0; color: #5e6879; }
.file-drop { display: grid; gap: 8px; place-items: center; padding: 34px 20px; border: 2px dashed #9bb0cd; border-radius: 14px; background: #f7faff; color: #143d78; cursor: pointer; text-align: center; transition: border-color .15s, background .15s; }
.file-drop:hover, .file-drop:focus-within { border-color: #143d78; background: #eef5ff; }
.file-drop span { color: #5e6879; font-weight: 400; }
.file-drop input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.upload-actions { display: flex; align-items: center; gap: 14px; margin-top: 16px; }
.extraction-result { padding: 12px 14px; margin-bottom: 18px; border-radius: 10px; border: 1px solid; }
.extraction-success { background: #eaf8ef; border-color: #82c49b; color: #155c31; }
.extraction-warning { background: #fff7dd; border-color: #e0be57; color: #624c08; }
.extraction-error { background: #fff0ef; border-color: #d99590; color: #7f1d1d; }
.monospace { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .025em; }
.back-link { display: inline-block; margin-bottom: 8px; color: #143d78; text-decoration: none; font-weight: 650; }
.empty-state { padding: 36px 16px; text-align: center; color: #5e6879; }
.empty-state p { margin-bottom: 0; }
.status-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.status-actions form { margin: 0; }
.partial-payment-form {
    padding-top: 16px; margin-top: 16px; border-top: 1px solid #e4e8ef;
}
.partial-payment-form > label {
    display: block; font-weight: 650; margin-bottom: 6px;
}
.partial-payment-controls {
    display: grid; grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px; align-items: stretch;
}
.partial-payment-controls input {
    width: 100%; min-height: 48px; padding: 11px 12px;
    border: 1px solid #aeb8c8; border-radius: 6px; font: inherit;
}
.partial-payment-controls .button { min-height: 48px; }
.status-counts {
    display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px;
}
.status-counts div {
    display: flex; justify-content: space-between; align-items: center; gap: 12px;
    border: 1px solid #e4e8ef; border-radius: 8px; padding: 12px;
}
.audit-list { list-style: none; padding: 0; margin: 0; }
.audit-list li { padding: 14px 0; border-bottom: 1px solid #e4e8ef; }
.audit-list li:last-child { border-bottom: 0; }

.commission-values-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px;
}
.commission-values-grid .field { margin-bottom: 18px; }
.commission-equivalent {
    display: flex; align-items: center; justify-content: space-between; gap: 16px;
    padding: 14px 16px; margin: 0 0 18px;
    border: 1px solid #cbd4e2; border-radius: 8px; background: #f7f9fc;
}
.commission-equivalent strong { font-size: 1.2rem; color: #143d78; }
.commission-alert {
    padding: 14px 16px; margin: 0 0 18px; border-radius: 8px; font-weight: 600;
}
.commission-alert-warning {
    background: #fff0c9; border: 1px solid #e2bd57; color: #6b4b00;
}
.commission-alert-danger {
    background: #fff0f0; border: 1px solid #d9a0a0; color: #821515;
}

.budget-items { margin: 20px 0; }
.budget-item-row {
    display: grid; grid-template-columns: 2fr 90px 130px 110px 48px;
    gap: 10px; align-items: end; padding: 16px; margin-bottom: 12px;
    background: white; border: 1px solid #dfe5ef; border-radius: 10px;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.budget-item-row .field { margin-bottom: 0; }
.field-label { display: block; font-weight: 650; margin-bottom: 6px; font-size: .95rem; }
.budget-item-total-wrap { text-align: right; }
.budget-item-total { font-weight: 650; min-height: 48px; display: flex; align-items: center; justify-content: flex-end; }
.item-remove {
    min-height: 48px; min-width: 48px; border: 1px solid #d9a0a0; border-radius: 6px;
    background: white; color: #a21b1b; font: inherit; font-weight: 700; cursor: pointer;
}
.budget-summary {
    background: white; border: 1px solid #dfe5ef; border-radius: 10px;
    padding: 20px 24px; margin: 24px 0; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
}
.budget-summary-row {
    display: flex; justify-content: space-between; gap: 12px; padding: 8px 0;
    border-bottom: 1px solid #e4e8ef;
}
.budget-summary-row:last-child { border-bottom: none; }
.budget-summary-row.total { font-weight: 700; font-size: 1.15rem; padding-top: 14px; }

@media (max-width: 640px) {
    .budget-item-row { grid-template-columns: 1fr; }
    .budget-item-total-wrap { text-align: left; }
    .budget-item-total { justify-content: flex-start; }
    .item-remove { width: 100%; }
}

/* Agendamentos */
.eyebrow {
    display: block; margin-bottom: 4px; color: #47617f;
    font-size: .78rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase;
}
.section-heading, .calendar-heading {
    display: flex; justify-content: space-between; align-items: center; gap: 16px;
    margin-bottom: 18px;
}
#daily-agenda, #monthly-calendar { scroll-margin-top: 80px; }
.section-heading h2, .calendar-heading h2 { margin: 0; }
.appointment-filter-card { padding-bottom: 20px; }
.appointment-filter-grid {
    grid-template-columns: repeat(4, minmax(150px, 1fr)) auto;
    margin-bottom: 0;
}
.daily-agenda { display: grid; gap: 8px; }
.agenda-row {
    display: grid; grid-template-columns: 78px minmax(180px, 2fr) minmax(140px, 1fr) auto;
    gap: 16px; align-items: center; min-height: 72px; padding: 12px 14px;
    border: 1px solid #e1e7f0; border-radius: 10px; color: inherit; text-decoration: none;
    transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.agenda-row:hover {
    border-color: #8ba7cc; transform: translateY(-1px);
    box-shadow: 0 5px 14px rgba(20, 61, 120, .08);
}
.agenda-row time { color: #143d78; font-size: 1.15rem; font-weight: 750; }
.agenda-row span:not(.status) { display: flex; flex-direction: column; min-width: 0; }
.agenda-row small { color: #667085; overflow: hidden; text-overflow: ellipsis; }
.empty-state {
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    padding: 36px 20px; border: 1px dashed #bdc8d7; border-radius: 10px;
    background: #fafbfc; color: #667085; text-align: center;
}
.empty-state strong { color: #27364f; }
.week-board {
    display: grid; grid-template-columns: repeat(7, minmax(135px, 1fr));
    gap: 8px; overflow-x: auto; padding-bottom: 4px;
}
.week-day {
    min-width: 135px; border: 1px solid #dfe5ef; border-radius: 10px;
    background: #f9fafc; overflow: hidden;
}
.week-day.is-selected { border-color: #4f8fd1; box-shadow: 0 0 0 2px #dcecff; }
.week-day-heading {
    display: flex; justify-content: space-between; padding: 10px 12px;
    background: #edf2f8; color: #27364f; text-decoration: none;
}
.week-day.is-selected .week-day-heading { background: #dcecff; color: #143d78; }
.week-day-items { display: grid; gap: 8px; padding: 8px; }
.week-appointment {
    display: flex; flex-direction: column; gap: 2px; padding: 9px;
    border-left: 3px solid #4f8fd1; border-radius: 6px;
    background: white; color: inherit; text-decoration: none;
    box-shadow: 0 1px 3px rgba(2, 31, 78, .08);
}
.week-appointment time { color: #143d78; font-weight: 750; }
.week-appointment strong, .week-appointment small {
    overflow: hidden; text-overflow: ellipsis;
}
.week-appointment small { color: #667085; }
.status-border-completed { border-left-color: #2d8a52; }
.status-border-cancelled { border-left-color: #b33a3a; opacity: .72; }
.week-empty { padding: 15px 4px; color: #8b95a5; font-size: .85rem; text-align: center; }
.calendar-heading { justify-content: center; }
.calendar-heading > div { min-width: 160px; text-align: center; }
.month-calendar {
    display: grid; grid-template-columns: repeat(7, minmax(80px, 1fr));
    border: 1px solid #dfe5ef; border-radius: 10px; overflow: hidden;
}
.calendar-weekday {
    padding: 9px; background: #edf2f8; color: #536176;
    font-size: .78rem; font-weight: 750; text-align: center;
}
.calendar-day {
    min-height: 92px; padding: 9px; border-top: 1px solid #e4e8ef;
    border-right: 1px solid #e4e8ef; color: inherit; text-decoration: none;
}
.calendar-day:nth-child(7n) { border-right: 0; }
.calendar-day > span {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px; border-radius: 50%; font-weight: 700;
}
.calendar-day strong {
    display: block; margin-top: 8px; padding: 5px 7px; border-radius: 6px;
    background: #dcecff; color: #174d83; font-size: .76rem;
}
.calendar-day.outside { background: #fafbfc; color: #9aa3b0; }
.calendar-day.selected { background: #f2f7fd; box-shadow: inset 0 0 0 2px #4f8fd1; }
.calendar-day.selected > span { background: #143d78; color: white; }
.appointment-form-grid {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px;
}
.appointment-form-grid .card { margin-bottom: 20px; }
.appointment-time-grid {
    display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 12px;
}
.form-footer {
    display: flex; justify-content: flex-end; align-items: center; gap: 10px;
}
.appointment-history { list-style: none; margin: 0; padding: 0; }
.appointment-history li {
    position: relative; display: grid; grid-template-columns: 18px 1fr;
    gap: 12px; padding-bottom: 22px;
}
.appointment-history li:not(:last-child)::before {
    content: ""; position: absolute; left: 6px; top: 16px; bottom: 0;
    width: 2px; background: #dfe5ef;
}
.history-marker {
    position: relative; z-index: 1; width: 14px; height: 14px; margin-top: 4px;
    border: 3px solid #4f8fd1; border-radius: 50%; background: white;
}
.history-content { min-width: 0; }
.history-content > strong, .history-content > span { display: block; }
.history-content p { margin: 8px 0; }
.history-changes {
    display: grid; gap: 6px; margin-top: 10px; padding: 10px;
    border-radius: 8px; background: #f7f9fc;
}
.history-changes div {
    display: grid; grid-template-columns: minmax(90px, .7fr) 1fr 1fr; gap: 10px;
}
.history-changes span { color: #5e6879; font-size: .85rem; font-weight: 650; }
.history-changes del { color: #8a1c13; }
.history-changes ins { color: #155c31; text-decoration: none; }
.status-scheduled { background: #dcecff; color: #174d83; }
.status-completed { background: #dff4e7; color: #155c31; }
.status-cancelled { background: #f5dfdf; color: #7f1d1d; }

@media (max-width: 980px) {
    .appointment-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .appointment-filter-grid .filter-actions { grid-column: 1 / -1; justify-content: flex-end; }
    .appointment-form-grid { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 640px) {
    .appointment-filter-grid { grid-template-columns: 1fr; }
    .appointment-filter-grid .filter-actions { grid-column: auto; }
    .agenda-row {
        grid-template-columns: 64px 1fr auto; gap: 10px;
    }
    .agenda-row > span:nth-of-type(2) { display: none; }
    .appointment-time-grid { grid-template-columns: 1fr; gap: 0; }
    .month-calendar { min-width: 630px; }
    .card:has(.month-calendar) { overflow-x: auto; }
    .form-footer { align-items: stretch; flex-direction: column-reverse; }
    .form-footer .button { width: 100%; }
    .history-changes div { grid-template-columns: 1fr; gap: 2px; }
}

.bar-chart { display: flex; align-items: flex-end; gap: 32px; height: 180px; padding: 16px 8px 0; }
.bar-chart-item { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1; height: 100%; }
.bar-chart-value { font-weight: 700; margin-bottom: 8px; }
.bar-chart-bar { width: 100%; max-width: 72px; border-radius: 6px 6px 0 0; min-height: 4px; }
.bar-chart-bar-installation { background: #143d78; }
.bar-chart-bar-cleaning { background: #4f8fd1; }
.bar-chart-label { margin-top: 10px; font-size: .85rem; color: #5e6879; text-align: center; }

@media (max-width: 760px) {
    .has-sidebar { padding-left: 0; padding-top: 64px; }
    .has-sidebar.sidebar-collapsed { padding-left: 0; }
    .mobile-header {
        position: fixed; inset: 0 0 auto 0; z-index: 30; height: 64px;
        display: flex; align-items: center; gap: 12px; padding: 0 16px;
        background: #021f4e; color: white;
        box-shadow: 0 3px 14px rgba(2, 31, 78, .18);
    }
    .mobile-menu-toggle { display: inline-flex; font-size: 1.35rem; }
    .mobile-brand {
        min-width: 0; color: white; text-decoration: none; font-weight: 700;
        display: inline-flex; align-items: center; gap: 10px;
        overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
    }
    .mobile-brand .brand-logo { width: 34px; height: 34px; }
    .sidebar {
        z-index: 50; width: min(86vw, 300px);
        transform: translateX(-105%);
        box-shadow: 8px 0 26px rgba(2, 15, 36, .32);
    }
    .sidebar-header { margin-bottom: 16px; }
    .sidebar-toggle .toggle-icon { transform: none; }
    .sidebar-backdrop {
        position: fixed; inset: 0; z-index: 45; width: 100%; height: 100%;
        border: 0; padding: 0; background: rgba(2, 15, 36, .58);
        opacity: 0; pointer-events: none; cursor: pointer;
        transition: opacity .25s ease;
    }
    .sidebar-open { overflow: hidden; }
    .sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-open .sidebar-backdrop { display: block; opacity: 1; pointer-events: auto; }
    .page-header { align-items: flex-start; flex-direction: column; }
    .metrics { grid-template-columns: 1fr; }
    .search-bar { flex-direction: column; }
    .search-bar .button { width: 100%; }
    .filter-grid { grid-template-columns: 1fr; }
    .payable-form-grid { grid-template-columns: 1fr; }
    .payable-form-grid .field-wide { grid-column: auto; }
    .payable-filter-grid { grid-template-columns: 1fr; }
    .receivable-filter-grid { grid-template-columns: 1fr; }
    .receivable-filter-grid .filter-actions { grid-column: auto; justify-content: stretch; }
    .receivable-contact-form { grid-template-columns: 1fr; }
    .receivable-contact-form .button { width: 100%; }
    .receivable-detail-header-actions { width: 100%; justify-content: space-between; }
    .receivable-installment-grid { grid-template-columns: 1fr; }
    .finance-dashboard-header { align-items: flex-start; flex-direction: column; }
    .finance-kpi-grid, .finance-dashboard-grid { grid-template-columns: 1fr; }
    .finance-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .finance-schedule-row { grid-template-columns: 50px minmax(0, 1fr) auto; gap: 10px; padding: 12px 0; }
    .finance-schedule-row .finance-notification-state { grid-column: 2; }
    .finance-schedule-row .status { grid-column: 3; grid-row: 2; }
    .finance-schedule-value { grid-column: 3; grid-row: 1; }
    .upload-actions { align-items: stretch; flex-direction: column; }
    .commission-values-grid { grid-template-columns: 1fr; gap: 0; }
    .debts-filter-grid .filter-actions { grid-column: auto; justify-content: stretch; }
    .filter-actions .button { flex: 1; }
    .partial-payment-controls { grid-template-columns: 1fr; }
    .partial-payment-controls .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
    .has-sidebar, .sidebar, .sidebar-backdrop, .toggle-icon, .nav-label {
        transition: none;
    }
}

@media (min-width: 761px) and (max-width: 1000px) {
    .debts-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .receivable-installment-data { grid-template-columns: 1fr; }
    .receivable-installment-data > div:nth-child(odd) { border-right: 0; }
    .receivable-installment-data > div:nth-last-child(2) { border-bottom: 1px solid #e5eaf1; }
    .receivable-installment-actions .button, .receivable-installment-actions form { flex: 1 1 130px; }
    .receivable-installment-actions form .button { width: 100%; }
    .finance-kpi-grid, .finance-progress-legend, .finance-alert-grid { grid-template-columns: 1fr; }
    .finance-panel { padding: 18px; }
    .finance-schedule-row { grid-template-columns: 46px minmax(0, 1fr); }
    .finance-schedule-value { grid-column: 2; grid-row: 2; text-align: left; }
    .finance-schedule-row .finance-notification-state { grid-column: 2; grid-row: 3; }
    .finance-schedule-row .status { grid-column: 2; grid-row: 4; justify-self: start; }
    .confirmation-dialog-actions { flex-direction: column-reverse; }
    .confirmation-dialog-actions .button { width: 100%; }
    .responsive-table thead { display: none; }
    .responsive-table, .responsive-table tbody, .responsive-table tr, .responsive-table td {
        display: block; width: 100%;
    }
    .responsive-table tr {
        background: white; border: 1px solid #dfe5ef; border-radius: 10px;
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06); padding: 16px; margin-bottom: 16px;
    }
    .responsive-table td {
        border-bottom: none; padding: 8px 0; white-space: normal;
        display: flex; justify-content: space-between; align-items: center; gap: 12px;
    }
    .responsive-table td[data-label]::before {
        content: attr(data-label); font-weight: 650; color: #5e6879;
        font-size: .85rem; flex-shrink: 0;
    }
    .responsive-table td[data-label="Ações"],
    .responsive-table td[data-label="Quantidade"] {
        flex-direction: column; align-items: stretch;
    }
    .responsive-table td[data-label="Ações"]::before,
    .responsive-table td[data-label="Quantidade"]::before {
        margin-bottom: 6px;
    }
    .receivable-groups-table td:last-child,
    .receivable-installments-table td:last-child {
        position: static; box-shadow: none;
    }
}
