:root {
    --primary: #0d6efd;
    --primary-dark: #0a3d91;
    --bg: #f4f7fb;
    --sidebar: #102033;
    --text: #172033;
    --muted: #667085;
    --border: #dbe3ef;
    --sidebar-width: 270px;
    --sidebar-collapsed-width: 84px;
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    max-width: 100%;
    overflow-x: hidden;
}

body {
    color: var(--text);
    background: var(--bg);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

img,
svg,
video,
canvas,
table,
form,
fieldset {
    max-width: 100%;
}

input,
select,
textarea,
button {
    max-width: 100%;
}

a,
p,
span,
strong,
td,
th,
label,
button,
.btn {
    overflow-wrap: break-word;
    word-break: normal;
}

.action-buttons {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    gap: 6px;
    white-space: nowrap;
}

.action-buttons form {
    display: inline-flex;
    margin: 0;
}

.action-btn {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 36px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    color: #475467;
    line-height: 1;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.action-btn:hover,
.action-btn:focus {
    background: #f8fafc;
    color: var(--primary);
    border-color: #9ec5fe;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, .12);
}

.action-btn svg {
    width: 17px;
    height: 17px;
    stroke-width: 2;
}

.action-btn-edit {
    color: #0d6efd;
    border-color: #b6d4fe;
}

.action-btn-toggle {
    color: #b76e00;
    border-color: #ffdca8;
}

.action-btn-activate {
    color: #198754;
    border-color: #a3cfbb;
}

.action-btn-delete {
    color: #dc3545;
    border-color: #f1aeb5;
}

.action-btn-delete:hover,
.action-btn-delete:focus {
    background: #fff5f5;
    color: #b02a37;
    border-color: #ea868f;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, .12);
}

.action-label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: linear-gradient(135deg, #eef5ff, #ffffff 55%, #e8eef7);
}

.login-box {
    width: min(100%, 430px);
    padding: 32px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 20px 55px rgba(16, 32, 51, .12);
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: inline-grid;
    place-items: center;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font-weight: 800;
}

.app-shell {
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
}

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-width);
    overflow-y: auto;
    background: linear-gradient(180deg, #08182d 0%, #0f2743 54%, #07172a 100%);
    color: #fff;
    transform: translateX(0);
    transition: width .18s ease, transform .2s ease;
    z-index: 1040;
    box-shadow: 16px 0 35px rgba(8, 24, 45, .18);
}

.sidebar-brand {
    position: sticky;
    top: 0;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 18px 18px 16px;
    background: rgba(5, 17, 32, .94);
    backdrop-filter: blur(12px);
    font-weight: 700;
    z-index: 2;
}

.sidebar-nav {
    padding: 12px;
}

.sidebar-nav a {
    color: #d9e7ff;
    text-decoration: none;
}

.nav-direct,
.nav-group-toggle {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: #d9e7ff;
    text-align: left;
    text-decoration: none;
    transition: background .16s ease, color .16s ease;
}

.nav-direct:hover,
.nav-group-toggle:hover,
.nav-direct.active,
.nav-group.open > .nav-group-toggle {
    background: rgba(255, 255, 255, .09);
    color: #fff;
}

.nav-direct.active,
.nav-group.open > .nav-group-toggle {
    box-shadow: inset 3px 0 0 #4f8cff;
}

.nav-icon {
    width: 24px;
    height: 24px;
    display: inline-grid;
    flex: 0 0 24px;
    place-items: center;
    border-radius: 7px;
    background: rgba(255, 255, 255, .08);
    color: #fff;
    font-size: .82rem;
    font-weight: 800;
}

.nav-chevron {
    margin-left: auto;
    color: #b9c8dc;
    font-size: .8rem;
    transition: transform .16s ease;
}

.nav-group.open .nav-chevron {
    transform: rotate(180deg);
}

.nav-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height .18s ease;
}

.nav-group.open .nav-submenu {
    max-height: 560px;
}

.nav-submenu a {
    position: relative;
    display: block;
    margin: 2px 0 2px 37px;
    padding: 8px 10px 8px 14px;
    border-radius: 7px;
    color: #cfe0f6;
    font-size: .92rem;
}

.nav-submenu a::before {
    content: "";
    position: absolute;
    left: 2px;
    top: 50%;
    width: 5px;
    height: 5px;
    border-radius: 999px;
    background: rgba(207, 224, 246, .42);
    transform: translateY(-50%);
}

.nav-submenu a:hover,
.nav-submenu a.active {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.nav-submenu a.active::before {
    background: #4f8cff;
    box-shadow: 0 0 0 4px rgba(79, 140, 255, .18);
}

.nav-submenu a.nav-operational-base {
    font-weight: 600;
}

.sidebar-close {
    display: none;
    margin-left: auto;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .1);
    color: #fff;
    font-weight: 800;
}

.sidebar-logout {
    display: block;
    margin: 12px;
    padding: 11px 12px;
    border-radius: 8px;
    color: #d9e7ff;
    text-decoration: none;
}

.sidebar-logout:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.sidebar-collapse {
    width: calc(100% - 24px);
    min-height: 42px;
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 12px 0;
    padding: 10px 12px;
    border: 0;
    border-radius: 8px;
    background: rgba(255, 255, 255, .08);
    color: #d9e7ff;
    text-align: left;
}

.sidebar-collapse:hover {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.sidebar-collapse-icon {
    width: 24px;
    height: 24px;
    display: inline-grid;
    place-items: center;
    border-radius: 7px;
    background: rgba(255, 255, 255, .1);
    font-weight: 800;
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
}

body.sidebar-collapsed .content-shell {
    margin-left: var(--sidebar-collapsed-width);
    width: calc(100% - var(--sidebar-collapsed-width));
    max-width: calc(100% - var(--sidebar-collapsed-width));
}

body.sidebar-collapsed .sidebar-brand span:not(.brand-mark),
body.sidebar-collapsed .nav-direct span:not(.nav-icon),
body.sidebar-collapsed .nav-group-toggle span:not(.nav-icon),
body.sidebar-collapsed .nav-chevron,
body.sidebar-collapsed .nav-submenu,
body.sidebar-collapsed .sidebar-logout,
body.sidebar-collapsed .sidebar-collapse-text {
    display: none;
}

body.sidebar-collapsed .sidebar-brand,
body.sidebar-collapsed .nav-direct,
body.sidebar-collapsed .nav-group-toggle,
body.sidebar-collapsed .sidebar-collapse {
    justify-content: center;
}

body.sidebar-collapsed .sidebar-collapse-icon {
    transform: rotate(180deg);
}

.content-shell {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    max-width: calc(100% - var(--sidebar-width));
    overflow-x: hidden;
    transition: margin-left .18s ease, width .18s ease, max-width .18s ease;
}

.topbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    min-height: 68px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    background: rgba(255, 255, 255, .96);
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
}

.topbar-menu {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: var(--primary);
    font-weight: 700;
}

.topbar-menu-icon,
.topbar-menu-icon::before,
.topbar-menu-icon::after {
    display: block;
    width: 16px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
}

.topbar-menu-icon {
    position: relative;
}

.topbar-menu-icon::before,
.topbar-menu-icon::after {
    content: "";
    position: absolute;
    left: 0;
}

.topbar-menu-icon::before {
    top: -5px;
}

.topbar-menu-icon::after {
    top: 5px;
}

.topbar-title {
    min-width: 0;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.dropdown-toggle-no-caret::after {
    display: none !important;
}

.topbar-notify {
    position: relative;
}

.topbar-notify-toggle {
    position: relative;
    width: 40px;
    height: 40px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    color: #475467;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}

.topbar-notify-toggle:hover,
.topbar-notify-toggle:focus,
.topbar-notify.open .topbar-notify-toggle {
    color: var(--primary);
    border-color: #9ec5fe;
    background: #f8fbff;
    box-shadow: 0 0 0 3px rgba(13, 110, 253, .12);
}

.topbar-notify-icon {
    width: 20px;
    height: 20px;
}

.topbar-notify-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: #dc3545;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
}

.topbar-notify-dot {
    position: absolute;
    top: 7px;
    right: 7px;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: #198754;
    box-shadow: 0 0 0 2px #fff;
}

.topbar-notify-panel {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: min(380px, calc(100vw - 24px));
    max-height: min(72vh, 640px);
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 18px 40px rgba(16, 32, 51, .16);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity .15s ease, transform .15s ease, visibility .15s ease;
    z-index: 1100;
}

.topbar-notify-panel[hidden] {
    display: none !important;
}

.topbar-notify.open .topbar-notify-panel {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.topbar-notify-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px 10px;
    border-bottom: 1px solid var(--border);
}

.topbar-notify-head strong {
    display: block;
    font-size: 15px;
}

.topbar-notify-head span {
    display: block;
    color: var(--muted);
    font-size: 12px;
}

.topbar-notify-link {
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
}

.topbar-notify-meta {
    padding: 8px 16px 0;
    color: var(--muted);
    font-size: 11px;
}

.topbar-notify-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.topbar-notify-stat {
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #f8fafc;
}

.topbar-notify-stat > span {
    display: block;
    color: var(--muted);
    font-size: 11px;
}

.topbar-notify-stat strong {
    display: block;
    margin-top: 2px;
    font-size: 15px;
}

.topbar-notify-stat small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.topbar-notify-stat-alert {
    background: #fff8e8;
    border-color: #ffdca8;
}

.topbar-notify-section {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}

.topbar-notify-section:last-child {
    border-bottom: 0;
}

.topbar-notify-section-title {
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--muted);
}

.topbar-notify-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.topbar-notify-item + .topbar-notify-item {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px dashed var(--border);
}

.topbar-notify-item-main {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.topbar-notify-item-main strong {
    font-size: 13px;
    font-weight: 600;
}

.topbar-notify-item-main span {
    font-size: 13px;
    font-weight: 700;
    white-space: nowrap;
}

.topbar-notify-item-meta {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.topbar-notify-tag {
    display: inline-flex;
    align-items: center;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
}

.topbar-notify-tag-success {
    background: #d1e7dd;
    color: #0f5132;
}

.topbar-notify-tag-warning {
    background: #fff3cd;
    color: #664d03;
}

.topbar-notify-tag-danger {
    background: #f8d7da;
    color: #842029;
}

.topbar-notify-empty {
    margin: 0;
    color: var(--muted);
    font-size: 12px;
}

.topbar-notify-foot {
    padding: 10px 16px 14px;
    color: var(--muted);
    font-size: 11px;
    background: #f8fafc;
}

.page-content {
    padding: 24px;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow-x: hidden;
}

.metric-card,
.panel,
.integration-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 25px rgba(16, 32, 51, .05);
}

.metric-card {
    min-height: 128px;
    padding: 22px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: transform .16s ease, box-shadow .16s ease;
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 35px rgba(16, 32, 51, .09);
}

.metric-card span {
    color: var(--muted);
}

.metric-card strong {
    font-size: 2.2rem;
    line-height: 1;
}

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

.dashboard-head h2 {
    margin: 0;
    color: #102033;
    font-size: 1.55rem;
    font-weight: 800;
}

.dashboard-head p {
    margin: 4px 0 0;
    color: var(--muted);
}

.dashboard-card {
    position: relative;
    gap: 14px;
    border-left: 4px solid var(--primary);
    background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
}

.dashboard-card strong {
    font-size: 1.55rem;
    overflow-wrap: break-word;
}

.dashboard-card-label {
    font-size: .9rem;
    font-weight: 600;
    color: var(--muted);
}

.dashboard-card-icon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 34px;
    height: 34px;
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    background: rgba(13, 110, 253, .08);
    color: var(--primary);
    font-weight: 900;
}

.dashboard-card-positive strong {
    color: #198754;
}

.dashboard-card-positive {
    border-left-color: #198754;
}

.dashboard-card-positive .dashboard-card-icon {
    background: rgba(25, 135, 84, .1);
    color: #198754;
}

.dashboard-card-negative {
    border-left-color: #dc3545;
}

.dashboard-card-negative strong {
    color: #dc3545;
}

.dashboard-card-negative .dashboard-card-icon {
    background: rgba(220, 53, 69, .1);
    color: #dc3545;
}

.dashboard-card-warning {
    border-left-color: #ffc107;
}

.dashboard-card-warning strong {
    color: #e67700;
}

.dashboard-card-warning .dashboard-card-icon {
    background: rgba(255, 193, 7, .14);
    color: #e67700;
}

.finance-account-card {
    height: 100%;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: linear-gradient(180deg, #fff 0%, #fbfdff 100%);
}

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

.finance-account-grid dt {
    color: var(--muted);
    font-size: .78rem;
    font-weight: 600;
}

.finance-account-grid dd {
    margin: 2px 0 0;
    font-weight: 700;
}

.dashboard-list {
    display: grid;
    gap: 10px;
}

.dashboard-list-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.dashboard-list-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.dashboard-list-item strong,
.dashboard-list-item div {
    overflow-wrap: break-word;
    word-break: normal;
}

.panel .alert {
    border-radius: 8px;
    border-width: 1px;
}

.dashboard-table td,
.dashboard-table th {
    white-space: nowrap;
}

.dashboard-table td:nth-child(3) {
    min-width: 220px;
    white-space: normal;
}

.op-form {
    display: grid;
    gap: 18px;
}

.op-page-head {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.op-page-head h2 {
    margin: 0;
    color: #102033;
    font-size: 1.45rem;
    font-weight: 800;
}

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

.op-page-icon,
.op-step {
    display: inline-grid;
    place-items: center;
    border-radius: 10px;
    background: #0d6efd;
    color: #fff;
    font-weight: 800;
}

.op-page-icon {
    width: 42px;
    height: 42px;
    flex: 0 0 42px;
    box-shadow: 0 12px 24px rgba(13, 110, 253, .22);
}

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

.op-form-card {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(16, 32, 51, .05);
}

.op-form-card-wide {
    grid-column: 1 / -1;
}

.op-card-title {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.op-step {
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    font-size: .95rem;
}

.op-card-title h3 {
    margin: 0;
    color: #102033;
    font-size: 1rem;
    font-weight: 800;
}

.op-card-title p {
    margin: 2px 0 0;
    color: var(--muted);
    font-size: .9rem;
}

.op-form-card .form-label {
    color: #102033;
    font-size: .84rem;
    font-weight: 700;
}

.op-form-card .form-control,
.op-form-card .form-select {
    min-height: 44px;
    border-color: #ccd7e6;
    border-radius: 8px;
}

.op-form-card textarea.form-control {
    min-height: 128px;
}

.op-check-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: #f8fbff;
}

.op-check-row label {
    display: grid;
    gap: 2px;
}

.op-check-row span {
    color: var(--muted);
    font-size: .88rem;
}

.op-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 14px 0 0;
}

.op-actions .btn {
    min-width: 130px;
}

.op-table-wrap {
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fff;
}

.op-list-table {
    margin-bottom: 0;
}

.op-list-table th {
    color: #44546a;
    font-size: .82rem;
    font-weight: 800;
}

.op-list-table td,
.op-list-table th {
    padding: 14px 16px;
}

.op-list-table td {
    vertical-align: middle;
}

.panel {
    padding: 22px;
    overflow-wrap: break-word;
}

.row {
    min-width: 0;
}

.row > * {
    min-width: 0;
}

.table-responsive {
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
}

.table {
    max-width: 100%;
}

.table th,
.table td {
    word-break: normal;
    overflow-wrap: break-word;
}

.contas-pagar-form {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: clip;
}

.contas-pagar-form .border,
.contas-pagar-form .table-responsive {
    width: 100%;
    min-width: 0;
    max-width: 100%;
}

.forma-lancamento-options {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
    max-width: 100%;
}

.forma-lancamento-options .btn {
    width: 100%;
    min-width: 0;
}

.contas-parcelas-table {
    width: 100%;
    max-width: 100%;
    table-layout: fixed;
}

.contas-parcelas-table th,
.contas-parcelas-table td {
    width: auto;
    min-width: 0;
    white-space: normal;
}

.contas-parcelas-table th:nth-child(1),
.contas-parcelas-table td:nth-child(1) {
    width: 18%;
}

.contas-parcelas-table th:nth-child(2),
.contas-parcelas-table td:nth-child(2),
.contas-parcelas-table th:nth-child(3),
.contas-parcelas-table td:nth-child(3) {
    width: 31%;
}

.contas-parcelas-table th:nth-child(4),
.contas-parcelas-table td:nth-child(4) {
    width: 20%;
}

.contas-parcelas-table .form-control {
    width: 100%;
    min-width: 0;
}

@media (max-width: 575.98px) {
    .contas-parcelas-table {
        font-size: .875rem;
    }

    .contas-parcelas-table th,
    .contas-parcelas-table td {
        padding-right: .35rem;
        padding-left: .35rem;
    }

    .contas-parcelas-table .form-control,
    .contas-parcelas-table .btn {
        padding-right: .35rem;
        padding-left: .35rem;
        font-size: .875rem;
    }
}

.integration-card {
    min-height: 108px;
    padding: 18px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    color: var(--text);
    text-decoration: none;
}

.integration-card:hover {
    border-color: var(--primary);
    color: var(--primary-dark);
}

.sidebar-backdrop {
    display: none;
}

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

    body.sidebar-collapsed .sidebar,
    .sidebar {
        width: min(80vw, 330px);
        max-width: 80vw;
        transform: translateX(-100%);
    }

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

    .sidebar-backdrop.show {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(7, 17, 32, .64);
        z-index: 1030;
    }

    .sidebar-close {
        display: inline-grid;
        place-items: center;
    }

    .sidebar-collapse {
        display: none;
    }

    body.sidebar-collapsed .content-shell,
    .content-shell {
        margin-left: 0;
        width: 100%;
        max-width: 100%;
    }

    body.sidebar-collapsed .sidebar-brand span:not(.brand-mark),
    body.sidebar-collapsed .nav-direct span:not(.nav-icon),
    body.sidebar-collapsed .nav-group-toggle span:not(.nav-icon),
    body.sidebar-collapsed .nav-chevron,
    body.sidebar-collapsed .sidebar-logout {
        display: inline-flex;
    }

    body.sidebar-collapsed .nav-submenu {
        display: block;
    }

    .topbar {
        padding: 12px 16px;
    }

    .page-content {
        padding: 16px;
    }

    .finance-account-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-list-item {
        align-items: stretch;
        flex-direction: column;
        gap: 6px;
    }

    .dashboard-list-item .text-end {
        text-align: left !important;
    }

    .topbar-user span {
        max-width: 130px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dropdown-toggle-no-caret::after {
        display: none !important;
    }
}

@media (max-width: 767.98px) {
    .table-responsive:not(.op-table-wrap) .table:not(.dashboard-table) {
        min-width: 680px;
    }

    .table-responsive {
        border-radius: 8px;
    }

    .op-page-head {
        align-items: flex-start;
        flex-wrap: wrap;
        gap: 10px;
    }

    .op-page-head h2 {
        font-size: 1.08rem;
    }

    .op-page-head p {
        font-size: .88rem;
    }

    .op-page-head .btn {
        width: 100%;
        margin-left: 0 !important;
    }

    .op-form-grid {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .op-form-card {
        padding: 14px;
        border-radius: 9px;
    }

    .op-card-title {
        margin-bottom: 14px;
    }

    .op-form-card .form-control,
    .op-form-card .form-select {
        min-height: 42px;
        font-size: .9rem;
    }

    .op-actions {
        position: sticky;
        bottom: 0;
        z-index: 10;
        margin-right: -16px;
        margin-left: -16px;
        padding: 10px 16px;
        border-top: 1px solid var(--border);
        background: rgba(255, 255, 255, .96);
        backdrop-filter: blur(10px);
    }

    .op-actions .btn {
        flex: 1 1 0;
        min-width: 0;
    }

    .op-table-wrap {
        border: 0;
        background: transparent;
        overflow: visible;
    }

    .op-list-table {
        border-collapse: separate;
        border-spacing: 0 10px;
    }

    .op-list-table thead {
        display: none;
    }

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

    .op-list-table tr {
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 10px;
        background: #fff;
        box-shadow: 0 8px 20px rgba(16, 32, 51, .05);
    }

    .op-list-table td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 7px 0;
        border: 0;
        white-space: normal;
        text-align: right;
        overflow-wrap: break-word;
        word-break: normal;
    }

    .op-list-table td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        color: var(--muted);
        font-size: .78rem;
        font-weight: 800;
        text-align: left;
    }

    .op-list-table td:first-child {
        display: block;
        text-align: left;
    }

    .op-list-table td:first-child::before {
        display: block;
        margin-bottom: 3px;
    }

    .op-list-table td.text-end {
        text-align: right !important;
    }

    .op-list-table .btn-group {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
        gap: 6px;
    }

    .op-list-table .btn-group .btn,
    .op-list-table .btn-group form,
    .op-list-table .btn-group button {
        width: 100%;
        border-radius: 7px !important;
    }

    .dashboard-metrics {
        --bs-gutter-y: .75rem;
    }

    .dashboard-card {
        min-height: 92px;
        padding: 16px 58px 16px 16px;
    }

    .dashboard-card strong {
        font-size: 1.35rem;
    }

    .dashboard-head h2 {
        font-size: 1.2rem;
    }

    .dashboard-head p {
        font-size: .9rem;
    }

    .panel {
        padding: 16px;
    }

    .dashboard-table {
        border-collapse: separate;
        border-spacing: 0 10px;
        margin-bottom: 0;
    }

    .dashboard-table thead {
        display: none;
    }

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

    .dashboard-table tr {
        padding: 12px;
        border: 1px solid var(--border);
        border-radius: 8px;
        background: #fff;
        box-shadow: 0 8px 20px rgba(16, 32, 51, .05);
    }

    .dashboard-table td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        padding: 6px 0;
        border: 0;
        white-space: normal;
        text-align: right;
        overflow-wrap: break-word;
        word-break: normal;
    }

    .dashboard-table td::before {
        content: attr(data-label);
        flex: 0 0 42%;
        color: var(--muted);
        font-size: .78rem;
        font-weight: 700;
        text-align: left;
    }

    .dashboard-table td:nth-child(3) {
        min-width: 0;
    }

    .dashboard-table td.text-end {
        text-align: right !important;
    }
}

/* Relatorios internos */
.report-head {
    align-items: flex-start;
}

.report-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

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

.report-home-card {
    position: relative;
    min-height: 190px;
    overflow: hidden;
}

.report-home-card h3 {
    margin: 0 0 8px;
    font-size: 1rem;
}

.report-home-card strong {
    display: block;
    margin-bottom: 6px;
    color: var(--primary-dark);
    font-size: 1.85rem;
    line-height: 1;
}

.report-home-card p {
    min-height: 42px;
    margin-bottom: 16px;
    color: var(--muted);
}

.report-home-icon {
    position: absolute;
    top: 18px;
    right: 18px;
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    border-radius: 14px;
    background: rgba(13, 110, 253, .09);
    color: var(--primary-dark);
    font-weight: 800;
}

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

.report-kpi {
    min-height: 106px;
    padding: 18px;
    border-left: 4px solid var(--primary);
}

.report-kpi span {
    display: block;
    margin-bottom: 8px;
    color: var(--muted);
    font-size: .82rem;
    font-weight: 700;
}

.report-kpi strong {
    display: block;
    color: var(--primary-dark);
    font-size: 1.55rem;
    line-height: 1.12;
}

.report-kpi-success {
    border-left-color: #198754;
}

.report-kpi-success strong {
    color: #087447;
}

.report-kpi-danger {
    border-left-color: #dc3545;
}

.report-kpi-danger strong {
    color: #b02a37;
}

.report-kpi-warning {
    border-left-color: #ffc107;
}

.report-kpi-warning strong {
    color: #946200;
}

.report-kpi-info,
.report-kpi-primary {
    border-left-color: #0d6efd;
}

.report-bars {
    display: grid;
    gap: 12px;
}

.report-bar-row {
    display: grid;
    grid-template-columns: minmax(110px, 1fr) 2fr auto;
    align-items: center;
    gap: 10px;
}

.report-bar-row span {
    min-width: 0;
    color: var(--text);
    font-size: .9rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.report-bar-row div {
    height: 10px;
    overflow: hidden;
    border-radius: 999px;
    background: #edf2f7;
}

.report-bar-row i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #0d6efd, #45b3ff);
}

.report-bar-row strong {
    color: var(--primary-dark);
    font-size: .9rem;
}

@media (max-width: 1199.98px) {
    .report-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

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

@media (max-width: 767.98px) {
    .report-grid,
    .report-kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .report-home-card {
        min-height: 160px;
        padding: 14px;
    }

    .report-home-card strong,
    .report-kpi strong {
        font-size: 1.25rem;
    }

    .report-home-card p {
        min-height: auto;
        font-size: .86rem;
    }

    .report-home-icon {
        width: 38px;
        height: 38px;
        border-radius: 10px;
        font-size: .82rem;
    }

    .report-actions {
        width: 100%;
    }

    .report-actions .btn {
        flex: 1 1 0;
    }

    .report-bar-row {
        grid-template-columns: 1fr auto;
    }

    .report-bar-row div {
        grid-column: 1 / -1;
        order: 3;
    }
}

@media print {
    .sidebar,
    .topbar,
    .sidebar-backdrop,
    .report-actions,
    form,
    .btn {
        display: none !important;
    }

    .content-shell,
    body.sidebar-collapsed .content-shell {
        margin-left: 0 !important;
    }

    .page-content {
        padding: 0 !important;
    }

    .panel {
        box-shadow: none !important;
        break-inside: avoid;
    }
}

/* Modulo Pessoas - perfis em cards responsivos */
.pessoa-perfis-grid {
    margin-top: 4px;
}

.pessoa-perfil-card {
    width: 100%;
    min-height: 48px;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border, #cfd8e3);
    border-radius: 10px;
    background: #fff;
    color: var(--text, #111827);
    font-weight: 600;
    cursor: pointer;
    user-select: none;
    transition: border-color .15s ease, background .15s ease, box-shadow .15s ease, color .15s ease;
}

.pessoa-perfil-card:hover {
    border-color: var(--primary, #0d6efd);
    background: #f8fbff;
}

.pessoa-perfil-checkbox {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--primary, #0d6efd);
}

.pessoa-perfil-card:has(.pessoa-perfil-checkbox:checked) {
    border-color: var(--primary, #0d6efd);
    background: #eaf2ff;
    color: var(--primary-dark, #084298);
    box-shadow: 0 0 0 3px rgba(13, 110, 253, .12);
}

.pessoa-perfil-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
    .pessoa-perfil-card {
        min-height: 44px;
        padding: 9px 10px;
        font-size: .92rem;
    }
}


/* ============================================================
   LAYOUT: page-header, summary-grid, filters-grid
   ============================================================ */

.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.page-header h1 {
    margin: 0 0 4px 0;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
}

.page-header p {
    margin: 0;
    color: var(--muted);
    font-size: .92rem;
}

.page-header > div {
    flex: 1;
}

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.summary-grid .card,
.summary-grid .metric-card {
    padding: 20px 24px;
    min-height: unset;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.summary-grid .card span,
.summary-grid .metric-card span {
    display: block;
    font-size: .82rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .04em;
}

.summary-grid .card strong,
.summary-grid .metric-card strong {
    display: block;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text);
    line-height: 1.2;
}

.filters-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px 16px;
    align-items: end;
    padding: 20px 24px;
}

.filters-grid .form-group {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.filters-grid .form-group label {
    font-size: .82rem;
    font-weight: 600;
    color: var(--muted);
}

.filters-grid .form-group input,
.filters-grid .form-group select {
    width: 100%;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: .92rem;
    background: #fff;
    color: var(--text);
}

.filters-grid .form-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    padding-top: 4px;
}

@media (max-width: 991px) {
    .summary-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 575px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

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

    .page-header {
        flex-direction: column;
    }
}
