:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fbff;
    --surface-accent: #e0ecff;
    --text: #1b2733;
    --muted: #64748b;
    --line: #e4e8ee;
    --green: #00aad1;
    --green-soft: #dbeafe;
    --danger: #cf4d4d;
    --warn: #cf8d2e;
    --shadow: 0 8px 24px rgba(14, 30, 37, 0.07);
    --radius: 14px;
    --font-sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* {
    box-sizing: border-box;
    font-synthesis: none;
}

html {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    color: var(--text);
    font-family: var(--font-sans);
    background: var(--bg);
}

html,
body,
button,
input,
select,
textarea {
    font-family: var(--font-sans);
    font-weight: 400;
}

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

a:hover {
    text-decoration: underline;
}

h1, h2, h3 {
    margin: 0 0 6px;
}

h1 {
    font-size: 2rem;
    font-weight: 700;
}

h2 {
    font-size: 1.25rem;
    font-weight: 650;
}

h3 {
    font-size: 1rem;
    font-weight: 650;
}

.app-shell {
    display: grid;
    grid-template-columns: 264px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: #f8fbff;
    border-right: 1px solid var(--line);
    padding: 14px 10px 10px;
    position: sticky;
    top: 0;
    height: 100vh;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 9px;
    margin: 0 6px 12px;
    padding: 12px 10px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid #e8ebf0;
}

.brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: var(--green-soft);
    color: var(--green);
}

.brand-mark svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}

.brand-text {
    font-size: 2.05rem;
    line-height: 0.95;
    font-weight: 700;
    letter-spacing: -0.03em;
    color: #0f172a;
}

.menu {
    display: flex;
    flex-direction: column;
    gap: 5px;
    flex: 1 1 auto;
    min-height: 0;
    padding: 2px 4px;
}

.menu a,
.menu-link-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 10px 11px;
    border-radius: 9px;
    color: #334155;
    font-size: 0.97rem;
    font-weight: 550;
    text-decoration: none;
    border: 1px solid transparent;
    transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease;
}

.menu-icon {
    width: 18px;
    height: 18px;
    display: inline-grid;
    place-items: center;
    color: #94a3b8;
    flex: 0 0 18px;
}

.menu-icon svg {
    width: 16px;
    height: 16px;
    fill: currentColor;
}

.menu a.active,
.menu-link-btn.active {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.menu a.active .menu-icon,
.menu-link-btn.active .menu-icon {
    color: #fff;
}

.menu a:hover,
.menu-link-btn:hover {
    text-decoration: none;
    background: #eef4ff;
    border-color: #dbe4ef;
}

.menu a.is-placeholder,
.menu a.is-placeholder .menu-icon {
    color: #5f6b76;
}

.menu-link-btn {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    text-align: left;
    font: inherit;
}

.menu-divider {
    border: 0;
    border-top: 1px solid #dbe4ef;
    margin: 8px 2px 2px;
}

.menu-footer {
    margin-top: auto;
    padding: 0 4px 4px;
}

.menu-logout-form {
    margin: 0;
    display: none;
}

/* Sidebar brand/logo overrides */
body .app-shell .sidebar .sidebar__top {
    padding: 4px 6px 8px;
}

body .app-shell .sidebar .brand-link {
    display: flex;
    align-items: center;
    padding: 8px 10px;
    border-radius: 10px;
    text-decoration: none !important;
}

body .app-shell .sidebar .brand-link:hover,
body .app-shell .sidebar .brand-link:focus-visible {
    text-decoration: none !important;
}

body .app-shell .sidebar .brand-logo-official {
    max-height: 34px;
    width: auto;
    max-width: 100%;
    height: auto;
    object-fit: contain;
    display: block;
}

body .app-shell .sidebar .brand-link-fallback {
    display: none;
    align-items: center;
    min-height: 34px;
    font-size: 0.92rem;
    font-weight: 650;
    color: #1e293b;
    letter-spacing: 0.01em;
}

.page-area {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.topbar {
    min-height: 64px;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: 10px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.top-left,
.top-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.top-left {
    min-width: 0;
    min-height: 40px;
    gap: 10px;
}

.top-right {
    margin-left: auto;
}

.topbar-page-title {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font: inherit;
    line-height: normal;
    letter-spacing: normal;
    color: inherit;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-rendering: auto;
}

.topbar-page-icon {
    flex: 0 0 auto;
    font-size: 1rem;
    color: #64748b;
}

.profile-menu {
    position: relative;
}

.profile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 4px 8px;
    border: 1px solid transparent;
    border-radius: 10px;
    background: transparent;
    color: #334155;
    font: inherit;
    cursor: pointer;
}

.profile-trigger:hover {
    background: #eef4ff;
    border-color: #dbe4ef;
}

.profile-trigger:focus-visible {
    outline: 2px solid #a0aab6;
    outline-offset: 1px;
}

.profile-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    overflow: hidden;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
    display: inline-grid;
    place-items: center;
    flex: 0 0 32px;
}

.profile-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.profile-avatar-fallback {
    font-size: 0.78rem;
    font-weight: 650;
    color: #475569;
}

.profile-avatar.is-fallback img {
    display: none;
}

.profile-avatar:not(.is-fallback) .profile-avatar-fallback {
    display: none;
}

.topbar-text-ui {
    font-family: inherit;
    font-size: 0.94rem;
    font-weight: 600;
    line-height: normal;
    letter-spacing: normal;
    color: #334155;
}

/* Enforce page-title text to match user name typography exactly. */
.topbar .top-left .topbar-page-title .topbar-page-text {
    font-family: inherit !important;
    font-size: 0.94rem !important;
    font-weight: 600 !important;
    line-height: normal !important;
    letter-spacing: normal !important;
    color: #334155 !important;
}

.profile-caret {
    font-size: 0.65rem;
    color: #7f8a96;
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 188px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 26px rgba(14, 30, 37, 0.12);
    z-index: 1200;
}

.profile-dropdown[hidden] {
    display: none;
}

.profile-dropdown-item {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #334155;
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 550;
    line-height: 1.3;
    padding: 8px 10px;
}

.profile-dropdown-item:hover {
    text-decoration: none;
    background: #eef4ff;
    border-color: #dbe4ef;
}

.profile-dropdown-item:focus-visible {
    outline: 2px solid #a0aab6;
    outline-offset: 1px;
}

.profile-dropdown-icon {
    width: 14px;
    color: #64748b;
    font-size: 0.84rem;
    text-align: center;
    flex: 0 0 14px;
}

.profile-dropdown-separator {
    border: 0;
    border-top: 1px solid #dbe4ef;
    margin: 4px 2px;
}

.top-search {
    display: flex;
    align-items: center;
    gap: 8px;
    border: 1px solid var(--line);
    background: var(--surface-soft);
    border-radius: 10px;
    padding: 6px 10px;
    color: #64748b;
}

.top-search input {
    border: 0;
    background: transparent;
    color: #475569;
    min-width: 180px;
    padding: 0;
}

.top-search input:focus {
    outline: none;
}

.pill {
    border: 1px solid var(--line);
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 0.75rem;
    color: #475569;
    background: var(--surface-soft);
}

.user-meta {
    font-weight: 600;
    color: #334155;
}

.avatar-placeholder {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
}

.page-content {
    padding: 20px;
}

.dashboard-blank-shell {
    min-height: calc(100vh - 104px);
    width: 100%;
    background: #ffffff;
}

.page-intro {
    margin-bottom: 14px;
}

.panel {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
}

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

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

.summary-icon {
    width: 54px;
    height: 54px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
}

.summary-pay {
    background: linear-gradient(180deg, #faf2e8 0%, #fff8ef 100%);
}

.summary-pay .summary-icon {
    background: #f5d9b3;
    color: #8f6125;
}

.summary-receive {
    background: linear-gradient(180deg, #ebf4ef 0%, #f4fbf7 100%);
}

.summary-receive .summary-icon {
    background: #bbddcb;
    color: var(--green);
}

.summary-card p {
    margin: 0;
    color: #6f7b86;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 12px;
}

/* Dashboard Premium */
.dash-page {
    display: grid;
    gap: 10px;
}

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

.dash-hero-card {
    margin-bottom: 0;
    display: grid;
    grid-template-columns: 52px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    text-decoration: none;
    color: inherit;
    min-height: 92px;
    transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.dash-hero-card:hover,
.dash-hero-card:focus-visible {
    text-decoration: none;
    color: inherit;
    border-color: #cdd6e0;
    box-shadow: 0 10px 24px rgba(14, 30, 37, 0.1);
    transform: translateY(-1px);
}

.dash-hero-icon {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 1.35rem;
}

.dash-hero-copy h2 {
    margin: 0;
    color: #22303d;
    font-size: 1.85rem;
    line-height: 1.05;
    font-weight: 700;
}

.dash-hero-count {
    margin: 2px 0 0;
    color: #435261;
    font-size: 0.9rem;
    font-weight: 650;
}

.dash-hero-meta {
    margin: 2px 0 0;
    color: #7a8794;
    font-size: 0.8rem;
}

.dash-hero-shape {
    width: 76px;
    height: 52px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    opacity: 0.3;
    font-size: 2rem;
}

.dash-hero-pay {
    background: linear-gradient(180deg, #fbf1e6 0%, #fff8f2 100%);
}

.dash-hero-pay .dash-hero-icon {
    background: #f2c88e;
    color: #8e5c1a;
}

.dash-hero-pay .dash-hero-shape {
    background: #f5d9b7;
    color: #9a651c;
    transform: rotate(-12deg);
}

.dash-hero-receive {
    background: linear-gradient(180deg, #e9f6ef 0%, #f4fbf8 100%);
}

.dash-hero-receive .dash-hero-icon {
    background: #a8d7bf;
    color: #1f7f5e;
}

.dash-hero-receive .dash-hero-shape {
    background: #c6e4d5;
    color: #1d7d5c;
    transform: rotate(10deg);
}

.dash-mid-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 12px;
    align-items: stretch;
}

.dashboard-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 320px;
    gap: 16px;
    align-items: stretch;
    width: 100%;
    min-width: 0;
}

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

.dashboard-main,
.dashboard-side {
    min-width: 0;
    width: 100%;
}

.dash-preportal-panel,
.dash-side-summary {
    margin-bottom: 0;
    width: 100%;
    min-width: 0;
}

.dash-preportal-panel {
    min-height: 240px;
    max-height: 240px;
    height: 240px;
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
}

.dash-side-summary {
    min-height: 240px;
    max-height: 240px;
    height: 240px;
    padding: 10px 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    contain: layout paint;
}

.dashboard-summary-card {
    overflow: hidden;
    height: 100%;
    padding: 12px;
}

.dashboard-summary-card * {
    min-width: 0;
}

.dash-preportal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 4px;
}

.dash-preportal-header h3 {
    margin: 0;
    color: #2c3a47;
}

.dash-preportal-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.dash-inline-link {
    appearance: none;
    border: 0;
    background: transparent;
    color: #6f7f8f;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    padding: 2px 0;
    text-decoration: none;
}

.dash-inline-link:hover,
.dash-inline-link:focus-visible {
    color: #2f8f73;
    text-decoration: none;
}

.dash-period-tabs {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #f3f6f9;
    border: 1px solid #e0e6ed;
    border-radius: 10px;
    padding: 3px;
}

.dash-tab-btn {
    border: 0;
    background: transparent;
    color: #5e6d7b;
    border-radius: 8px;
    padding: 5px 9px;
    font-size: 0.82rem;
    font-weight: 650;
    cursor: pointer;
}

.dash-tab-btn.active {
    background: #ffffff;
    color: #2f8f73;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.08);
}

.dash-tab-btn:disabled {
    opacity: 0.65;
    cursor: wait;
}

.dash-preportal-table-wrap {
    border: 1px solid #e2e8ef;
    border-radius: 12px;
    overflow-x: auto;
    overflow-y: auto;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    max-height: none;
    position: relative;
    width: 100%;
    align-self: stretch;
}

.dash-mini-table {
    width: 100%;
    min-width: 0;
    table-layout: fixed;
    border-collapse: collapse;
}

.dash-preportal-table-wrap.is-empty .dash-mini-table {
    display: none;
}

.dash-mini-table th,
.dash-mini-table td {
    padding: 7px 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
}

.dash-mini-table th {
    font-size: 0.77rem;
}

.dash-sort-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 0;
    padding: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    font-size: inherit;
    font-weight: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
}

.dash-sort-btn .sort-icon {
    font-size: 0.68rem;
    color: #98a4b0;
}

.dash-sort-btn[data-direction="asc"] .sort-icon,
.dash-sort-btn[data-direction="desc"] .sort-icon {
    color: #5f6a76;
}

.dash-sort-btn:focus-visible {
    outline: 2px solid rgba(47, 143, 115, 0.35);
    outline-offset: 2px;
    border-radius: 4px;
}

.dash-mini-table td {
    font-size: 0.83rem;
    line-height: 1.15;
}

.dash-row-clickable {
    cursor: pointer;
}

.dash-row-clickable:hover td,
.dash-row-clickable:focus-visible td {
    background: #f7fafc;
}

.dash-row-clickable:focus-visible {
    outline: 2px solid rgba(47, 143, 115, 0.25);
    outline-offset: -2px;
}

.dash-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 84px;
    border-radius: 999px;
    padding: 2px 10px;
    font-size: 0.74rem;
    font-weight: 650;
}

.dash-status-open {
    color: #5f6d7a;
    background: #eef2f6;
}

.dash-status-paid {
    color: #00aad1;
    background: #e0ecff;
}

.dash-status-overdue {
    color: #c94b4b;
    background: #fdeaea;
}

.dash-status-cancelled {
    color: #6b7280;
    background: #eef2f6;
}

.dash-empty-note {
    margin: 0;
    padding: 0 12px;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #7c8996;
    font-size: 0.85rem;
}

.dash-side-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.dash-side-head h3 {
    margin: 0;
    color: #2c3a47;
}

.dash-side-period {
    color: #748292;
    font-size: 0.8rem;
    font-weight: 650;
}

.summary-period {
    font-size: 12px;
    color: #6b7280;
    white-space: nowrap;
}

.dash-side-total {
    margin: 4px 0 0;
    color: #344251;
    font-size: 13px;
    white-space: nowrap;
}

.dash-side-total strong {
    font-size: 20px;
    font-weight: 600;
    letter-spacing: -0.01em;
    white-space: nowrap;
}

.summary-total {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.1;
    white-space: nowrap;
}

.dash-side-count {
    margin: 0 0 6px;
    color: #7b8794;
    font-size: 13px;
    white-space: nowrap;
    text-align: right;
    width: 100%;
}

.dash-side-status-list {
    list-style: none;
    margin: 0 0 6px;
    padding: 0;
    display: grid;
    gap: 6px;
}

.dash-side-status-list li {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    gap: 10px;
    color: #4f5f6f;
    font-size: 13px;
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 13px;
    gap: 8px;
    min-width: 0;
    width: 100%;
}

.summary-row .dash-status-label {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.summary-row .dash-status-label > span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-status-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    line-height: 1.2;
    min-height: 20px;
    white-space: nowrap;
}

.dash-side-metric {
    display: inline-flex;
    align-items: baseline;
    justify-content: flex-end;
    gap: 6px;
    line-height: 1;
    min-width: 0;
    max-width: none;
    flex: 0 0 auto;
    overflow: hidden;
    white-space: nowrap;
}

.dash-side-status-list strong {
    color: #2f3d4a;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-side-metric em {
    font-style: normal;
    color: #6e7d8c;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.summary-row span:last-child {
    white-space: nowrap;
    font-weight: 500;
}

.dash-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
}

.dash-dot-open {
    background: #99a5b2;
}

.dash-dot-paid {
    background: #2f8f73;
}

.dash-side-summary:not(.dash-side-summary-receber) .dash-dot-paid {
    background: #b98a2a;
}

.dash-side-summary-receber .dash-dot-paid {
    background: #2f8f73;
}

.dash-dot-overdue {
    background: #cf4d4d;
}

.dash-next-due {
    border-top: 1px solid #e5ebf1;
    padding-top: 6px;
    margin-top: 2px;
    margin-top: auto;
}

.summary-next {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid #eee;
}

.summary-next strong {
    font-size: 14px;
}

.summary-next small {
    display: block;
    font-size: 12px;
    color: #6b7280;
}

.dash-next-title {
    margin: 0;
    color: #7b8895;
    font-size: 0.75rem;
    font-weight: 650;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.dash-next-date {
    margin: 3px 0 0;
    color: #2f3d4a;
    font-size: 0.96rem;
    font-weight: 700;
    white-space: nowrap;
}

.dash-next-line {
    margin-top: 3px;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    min-width: 0;
}

.dash-next-inline-value {
    margin: 0;
    color: #475564;
    font-size: 0.8rem;
    white-space: nowrap;
}

.dash-next-name {
    margin: 2px 0 0;
    color: #5f6d7a;
    font-size: 0.84rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-next-value {
    margin: 5px 0 0;
    color: #475564;
    font-size: 0.82rem;
    white-space: nowrap;
}

.summary-row span {
    overflow: hidden;
    text-overflow: ellipsis;
}

.dash-next-value strong {
    font-size: 0.96rem;
    color: #2f3d4a;
}

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

.dash-chart-panel {
    margin-bottom: 0;
    padding: 10px 12px;
}

.dash-chart-header {
    margin-bottom: 6px;
}

.dash-chart-header h3 {
    margin: 0;
    color: #2c3a47;
    font-size: 1rem;
}

.dash-chart-wrap {
    height: 174px;
}

.dash-insight-panel {
    min-height: 154px;
}

.dash-drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(20, 30, 41, 0.4);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    z-index: 1120;
}

.dash-drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.dash-drawer-shell {
    position: fixed;
    top: 0;
    right: 0;
    width: min(100vw, 78vw);
    min-width: 620px;
    max-width: 1240px;
    height: 100vh;
    background: #fff;
    border-left: 1px solid #d7e0ea;
    box-shadow: -14px 0 34px rgba(16, 24, 40, 0.18);
    z-index: 1125;
    transform: translateX(102%);
    transition: transform 0.24s ease;
    display: grid;
    grid-template-rows: auto 1fr;
}

.dash-drawer-shell.open {
    transform: translateX(0);
}

.dash-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8ef;
}

.dash-drawer-header h3 {
    margin: 0;
    color: #2b3947;
    font-size: 1rem;
}

.dash-drawer-frame {
    width: 100%;
    height: 100%;
    border: 0;
    background: #f4f7fa;
}

body.dash-drawer-open {
    overflow: hidden;
}

.dash-category-insight-list {
    display: grid;
    gap: 8px;
}

.dash-category-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
}

.dash-category-meta {
    min-width: 0;
}

.dash-category-label {
    display: block;
    font-size: 0.83rem;
    color: #516170;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.dash-category-track {
    width: 100%;
    height: 7px;
    border-radius: 999px;
    background: #ecf1f5;
    overflow: hidden;
}

.dash-category-fill {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.dash-category-fill-pay {
    background: linear-gradient(90deg, #d9b15a 0%, #b98a2a 100%);
}

.dash-category-fill-receive {
    background: linear-gradient(90deg, #64ae9d 0%, #2f7f6f 100%);
}

.dash-category-value {
    font-size: 0.82rem;
    color: #3b4c5c;
    font-weight: 650;
    white-space: nowrap;
}

.dash-category-empty {
    margin: 0;
    color: #7c8996;
    font-size: 0.84rem;
    padding: 4px 0;
}

.card-header {
    margin-bottom: 8px;
}

.totals-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 14px;
}

.totals-grid strong {
    display: block;
    margin-top: 2px;
    font-size: 1.3rem;
}

.text-warn {
    color: var(--warn);
}

.text-ok {
    color: var(--green);
}

.quick-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

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

.button {
    border: 0;
    border-radius: 10px;
    padding: 9px 14px;
    font-weight: 650;
    cursor: pointer;
    background: var(--green);
    color: #fff;
}

.button:hover {
    filter: brightness(1.04);
}

.button.ghost {
    background: #fff;
    color: #4f5c67;
    border: 1px solid var(--line);
}

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

.button.icon {
    width: 40px;
    padding: 0;
    font-size: 1.25rem;
}

.link-button {
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--line);
    color: #4f5c67;
}

.link-button:hover {
    background: var(--surface-soft);
    text-decoration: none;
}

.form-grid {
    display: grid;
    gap: 12px;
}

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

label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 0.9rem;
    color: #6c7985;
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    padding: 10px 12px;
}

input:focus,
select:focus,
textarea:focus {
    outline: 3px solid color-mix(in srgb, var(--green) 22%, transparent);
    border-color: color-mix(in srgb, var(--green) 45%, #ffffff);
}

.with-plus {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px;
}

.switch-row {
    margin: 12px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

.switch-inline {
    flex-direction: row;
    align-items: center;
    gap: 8px;
}

.switch-inline input[type="checkbox"] {
    width: 16px;
    height: 16px;
    padding: 0;
    margin: 0;
    flex: 0 0 16px;
}

.table-panel {
    overflow: auto;
}

.empresas-panel {
    padding-top: 12px;
}

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

.empresas-search {
    width: min(420px, 100%);
}

.empresa-row {
    cursor: pointer;
    transition: background-color 0.16s ease;
}

.empresa-row:hover td {
    background: #f5f8fa;
}

table {
    width: 100%;
    min-width: 640px;
    border-collapse: collapse;
    text-rendering: optimizeLegibility;
}

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

th {
    font-size: 0.83rem;
    letter-spacing: 0.02em;
    color: #73808d;
    text-transform: uppercase;
}

.badge {
    display: inline-block;
    font-size: 0.75rem;
    font-weight: 650;
    padding: 4px 9px;
    border-radius: 999px;
}

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

.badge.paga {
    color: var(--green);
    background: var(--green-soft);
}

.badge.cancelada {
    color: var(--danger);
    background: #fce9e9;
}

.inline {
    margin: 0;
}

.inline-edit {
    display: grid;
    gap: 8px;
}

.inline-edit-1 {
    grid-template-columns: 1fr auto;
}

.inline-edit-2 {
    grid-template-columns: 1fr 1fr auto;
}

.inline-edit-4 {
    grid-template-columns: 0.7fr 1fr 1fr 1fr auto;
}

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

.summary-inline strong {
    display: block;
    margin-top: 2px;
    font-size: 0.95rem;
}

.detail-grid {
    overflow: auto;
}

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

.form-message {
    min-height: 18px;
    margin-bottom: 8px;
    font-size: 0.88rem;
    color: var(--muted);
}

.form-message.success {
    color: var(--green);
}

.form-message.error {
    color: var(--danger);
}

.global-message {
    margin-bottom: 10px;
    background: #ebf7f1;
    border: 1px solid #cae7da;
    color: var(--green);
    border-radius: 10px;
    padding: 9px 12px;
}

.global-message.hidden {
    display: none;
}

#toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 1200;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    min-width: 240px;
    max-width: 360px;
    border-radius: 10px;
    color: #fff;
    padding: 10px 12px;
    box-shadow: 0 12px 24px rgba(18, 28, 39, 0.18);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.9rem;
    pointer-events: auto;
    animation: toast-in 160ms ease;
}

.toast.success {
    background: #00aad1;
}

.toast.error {
    background: #cf4d4d;
}

.toast__message {
    margin: 0;
    line-height: 1.3;
}

.toast__close {
    border: 0;
    background: transparent;
    color: inherit;
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    padding: 0;
    opacity: 0.9;
}

.toast__close:hover {
    opacity: 1;
}

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

.auth-wrap {
    width: 100%;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.auth-panel {
    width: min(460px, 100%);
    border: 1px solid #e7edf3;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
}

.auth-brand {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 16px;
    margin-bottom: 16px;
}

.auth-brand--compact {
    align-items: center;
}

.auth-brand-logo {
    width: 88px;
    max-width: 88px;
    height: auto;
    object-fit: contain;
    display: block;
    flex: 0 0 auto;
}

.auth-brand-copy {
    display: grid;
    gap: 4px;
    min-width: 0;
}

.auth-brand-kicker {
    margin: 0;
    color: #00aad1;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.auth-brand-title {
    margin: 0;
    color: #0f172a;
    font-family: var(--font-sans);
    font-size: 1.28rem;
    line-height: 1.08;
    font-weight: 700;
    letter-spacing: -0.03em;
}

.auth-brand-subtitle-text {
    margin: 0;
    color: #6b7280;
    font-size: 0.9rem;
    line-height: 1.35;
}

.auth-panel .api-form {
    display: block;
}

.auth-panel .form-message {
    margin-bottom: 12px;
}

.auth-form-grid {
    gap: 14px;
}

.auth-panel .input {
    min-height: 42px;
    line-height: 1.35;
}

.form-separator {
    margin-top: 20px;
    margin-bottom: 20px;
}

.auth-actions {
    margin-top: 0;
}

.auth-layout-body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
}

.auth-page-content {
    min-height: 100vh;
}

.desmembramento-row {
    display: grid;
    grid-template-columns: 2fr 1fr auto;
    gap: 8px;
    margin-bottom: 8px;
}

.side-overlay {
    position: fixed;
    inset: 0;
    background: rgba(35, 45, 55, 0.25);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 998;
}

.side-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.side-panel {
    position: fixed;
    top: 0;
    right: -420px;
    width: min(420px, 100vw);
    height: 100vh;
    background: #fff;
    border-left: 1px solid var(--line);
    box-shadow: -14px 0 26px rgba(16, 24, 40, 0.08);
    transition: right 0.22s ease;
    z-index: 999;
}

.side-panel.open {
    right: 0;
}

.drawer-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(24, 35, 45, 0.38);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
    z-index: 1090;
}

.drawer-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

.drawer-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: min(100vw, clamp(380px, 30vw, 520px));
    height: 100vh;
    background: #fff;
    border-left: 1px solid var(--line);
    box-shadow: -16px 0 40px rgba(16, 24, 40, 0.14);
    padding: 18px 16px;
    z-index: 1100;
    transform: translateX(104%);
    pointer-events: none;
    transition: transform 0.24s ease;
    overflow-y: auto;
}

.drawer-panel.open {
    pointer-events: auto;
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

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

.panel-content {
    padding: 16px;
}

.panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.menu-toggle {
    display: none;
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 8px;
    color: #50606d;
    padding: 7px 9px;
}

.hidden {
    display: none !important;
}

@media (max-width: 1100px) {
    .dash-hero-grid,
    .dash-mid-grid,
    .dash-bottom-grid:not(.dash-analysis-grid),
    .dashboard-grid,
    .summary-strip,
    .two-col-actions,
    .summary-inline,
    .form-grid.two,
    .inline-edit-2,
    .inline-edit-4,
    .desmembramento-row {
        grid-template-columns: 1fr;
    }

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

@media (max-width: 900px) {
    .dash-preportal-panel {
        height: auto;
    }

    .dash-side-summary {
        height: auto;
    }

    .dash-preportal-table-wrap {
        max-height: 280px;
    }

    .dash-analysis-grid {
        grid-template-columns: 1fr;
    }

    .dash-hero-card {
        grid-template-columns: 46px 1fr;
    }

    .dash-hero-shape {
        display: none;
    }

    .dash-period-tabs {
        width: 100%;
        justify-content: space-between;
    }

    .dash-preportal-actions {
        width: 100%;
        display: grid;
        grid-template-columns: auto minmax(0, 1fr);
        align-items: center;
    }

    .dash-tab-btn {
        flex: 1 1 auto;
    }

    .dash-mini-table {
        min-width: 720px;
    }

    .dash-preportal-table-wrap {
        overflow: auto;
    }

    .dash-drawer-shell {
        width: 100vw;
        min-width: 0;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: fixed;
        left: -280px;
        width: 264px;
        z-index: 1000;
        transition: left 0.22s;
    }

    .sidebar.open {
        left: 0;
    }

    .menu-toggle {
        display: inline-block;
    }

    .top-search input {
        min-width: 120px;
    }
}

body.dashboard-drawer-embed .sidebar,
body.dashboard-drawer-embed .topbar,
body.dashboard-drawer-embed .dash-drawer-shell,
body.dashboard-drawer-embed .dash-drawer-backdrop {
    display: none !important;
}

body.dashboard-drawer-embed .page-area,
body.dashboard-drawer-embed .page-content {
    padding: 0;
    margin: 0;
}

body.dashboard-drawer-embed .page-content {
    background: #fff;
}

body.dashboard-drawer-embed .contas-search-panel,
body.dashboard-drawer-embed .table-panel,
body.dashboard-drawer-embed .empresas-summary {
    display: none !important;
}

body.dashboard-drawer-embed .drawer-backdrop {
    display: none !important;
}

body.dashboard-drawer-embed #conta-edit-close,
body.dashboard-drawer-embed #conta-receber-close {
    display: none !important;
}

body.dashboard-drawer-embed .drawer-panel {
    position: relative;
    top: 0;
    right: 0;
    width: 100%;
    min-width: 0;
    max-width: none;
    height: 100vh;
    transform: none !important;
    pointer-events: auto;
    border-left: 0;
    box-shadow: none;
    padding: 12px;
}

/* Empresas (scoped) */
.empresas-page {
    font-size: 1rem;
}

.empresas-header-row {
    align-items: flex-end;
    margin-bottom: 12px;
}

.empresas-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    width: min(560px, 100%);
}

.empresas-search {
    flex: 1 1 auto;
}

.empresas-panel {
    padding-top: 12px;
}

.empresas-panel table {
    min-width: 0;
}

.empresas-panel thead th,
.empresas-panel tbody td {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    color: #4d5966;
    letter-spacing: 0;
    text-transform: none;
}

.empresas-panel tbody td {
    color: #2f3c48;
}

.empresa-row {
    cursor: pointer;
    transition: background-color 0.16s ease;
}

.empresa-row:hover td {
    background: #f4f7f9;
}

.input {
    border-radius: 8px;
    border-color: #d6dbe3;
    background: #ffffff;
    color: #2f3c48;
}

.input::placeholder {
    color: #9aa4af;
}

.btn {
    border: 1px solid transparent;
    border-radius: 8px;
    padding: 9px 14px;
    font-weight: 600;
    font-size: 0.95rem;
    line-height: 1;
    cursor: pointer;
}

.btn-primary {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

.btn-primary:hover {
    background: #0094b8;
    border-color: #0094b8;
    filter: none;
}

.btn-ghost {
    background: #f3f5f8;
    border-color: #d8dee7;
    color: #475569;
}

.btn-close {
    background: transparent;
    border-color: #d8dee7;
    color: #6a7480;
    min-width: 34px;
    padding: 7px 10px;
}

.empresas-drawer {
    background: #f3f5f8;
}

.empresas-drawer .input {
    background: #ffffff;
}

.empresas-drawer-header {
    margin-bottom: 8px;
}

.drawer-divider {
    border: 0;
    border-top: 1px solid #dbe1e9;
    margin: 0 0 14px;
}

.empresas-drawer-actions {
    margin-top: 18px;
    padding-top: 8px;
    justify-content: flex-end;
}

/* Empresas refinements */
.empresas-page .empresas-toolbar {
    width: 100%;
    max-width: none;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 12px;
}

.empresas-page .empresas-search {
    flex: 0 1 280px;
    width: 280px;
}

.empresas-page .action-link {
    border: 0;
    background: transparent;
    color: var(--green);
    font-size: 1rem;
    font-weight: 600;
    padding: 4px 0;
    cursor: pointer;
    text-decoration: none;
}

.empresas-page .action-link:hover {
    color: var(--green);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.empresas-page .action-link:focus-visible,
.empresas-page .input:focus-visible,
.empresas-drawer .input:focus-visible {
    outline: 2px solid var(--green);
    outline-offset: 2px;
}

.empresas-page .input,
.empresas-drawer .input {
    font-size: 16px;
    padding: 10px 12px;
    border-radius: 8px;
}

.empresas-page .input::placeholder,
.empresas-drawer .input::placeholder {
    font-size: 14px;
}

.empresas-panel thead th {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.05em;
    color: #7f8b97;
    font-weight: 600;
}

.empresas-panel tbody td {
    font-size: 16px;
    font-weight: 500;
    color: #32404d;
}

.empresas-panel th,
.empresas-panel td {
    padding: 12px 16px;
}

.empresas-page .empresa-row {
    cursor: pointer;
}

.empresas-page .empresa-row:hover td {
    background: #f6f8fb;
}

.empresas-drawer {
    width: min(100vw, 460px);
    background: #ffffff;
    box-shadow: -14px 0 28px rgba(16, 24, 40, 0.12);
}

.empresas-drawer .input {
    background: #f6f8fb;
    border-color: #d5dce5;
}

.empresas-drawer .btn-ghost {
    background: #f3f5f8;
    border-color: #d8dee7;
    color: #5f6a76;
}

.empresas-drawer .btn-primary {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
}

@media (max-width: 900px) {
    .empresas-page .empresas-toolbar {
        justify-content: flex-start;
    }

    .empresas-page .empresas-search {
        flex: 1 1 100%;
        width: 100%;
    }
}

/* Empresas UX polish (CSS-only) */
:root {
    --green: #00aad1;
    --green-soft: #dbeafe;
}

body {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.empresas-page h1 {
    -webkit-font-smoothing: antialiased;
    text-rendering: geometricPrecision;
}

input,
select,
textarea,
.input,
.empresas-page .input,
.empresas-drawer .input {
    font-size: 16px;
    line-height: 1.4;
    padding: 10px 12px;
}

input::placeholder,
select::placeholder,
textarea::placeholder,
.input::placeholder,
.empresas-page .input::placeholder,
.empresas-drawer .input::placeholder {
    font-size: 14px;
}

input:focus,
select:focus,
textarea:focus,
.input:focus,
.empresas-page .input:focus,
.empresas-drawer .input:focus,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
.input:focus-visible,
.empresas-page .input:focus-visible,
.empresas-drawer .input:focus-visible {
    outline: 1px solid #8f98a3;
    outline-offset: 0;
    border-color: #8f98a3;
    box-shadow: none;
}

.empresas-page .empresas-search {
    flex: 0 1 320px;
    width: 320px;
}

.empresas-panel th,
.empresas-panel td {
    padding: 12px 16px;
}

.empresas-panel thead th {
    text-transform: uppercase;
    font-size: 12px;
    letter-spacing: 0.06em;
    color: #7f8b97;
    font-weight: 600;
}

.empresa-row {
    cursor: pointer;
}

.empresa-row:hover td {
    background: #f7f9fb;
}

.action-link,
.empresas-drawer-actions .btn {
    background: transparent;
    border: 0;
    color: var(--green);
    padding: 4px 0;
    border-radius: 0;
    font-size: 16px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    line-height: 1.3;
}

.action-link {
    font-family: var(--font-sans);
    font-size: 1rem;
    font-weight: 500;
    color: #0093b4;
}

.action-link-icon {
    font-size: 18px;
    font-weight: 600;
    line-height: 1;
}

.action-link:hover,
.empresas-drawer-actions .btn:hover {
    color: #0089a8;
    text-decoration: underline;
    text-underline-offset: 2px;
    background: rgba(0, 170, 209, 0.08);
    border-radius: 6px;
    filter: none;
}

.action-link:focus-visible,
.empresas-drawer-actions .btn:focus-visible {
    outline: 1px solid #8f98a3;
    outline-offset: 2px;
}

#empresa-edit-cancel::before {
    content: "↩";
    font-size: 14px;
}

.empresas-drawer-actions .btn-primary::before {
    content: "✓";
    font-size: 14px;
}

.empresas-drawer {
    width: min(100vw, 460px);
    background: #ffffff;
    box-shadow: -14px 0 28px rgba(16, 24, 40, 0.12);
}

.empresas-drawer .input {
    background: #f5f7fa;
    border-color: #d5dce5;
    border-radius: 8px;
}

/* Empresas final tune */
.empresas-page h1 {
    font-family: var(--font-sans);
    font-weight: 500;
    line-height: 1.15;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.empresas-page .action-link {
    color: #0094b8;
}

.empresas-page .action-link:hover {
    color: #007b96;
    background: rgba(0, 170, 209, 0.08);
}

.empresas-page .action-link:focus-visible,
.empresas-page .input:focus-visible,
.empresas-drawer .input:focus-visible,
.empresas-drawer-actions .btn:focus-visible {
    outline: 1px solid #8d96a1;
    border-color: #8d96a1;
    box-shadow: none;
}

.empresas-page .empresas-search {
    flex: 0 1 320px;
    width: 320px;
}

.empresas-page .input,
.empresas-drawer .input {
    font-size: 16px;
    line-height: 1.4;
    padding: 10px 12px;
}

.empresas-page .input::placeholder,
.empresas-drawer .input::placeholder {
    font-size: 14px;
}

.empresas-panel th,
.empresas-panel td {
    padding: 12px 16px;
}

.empresas-panel thead th {
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-size: 12px;
    font-weight: 600;
    color: #7f8b97;
}

.empresas-page .empresa-row {
    cursor: pointer;
}

.empresas-page .empresa-row:hover td {
    background: #f7f9fb;
}

.empresas-drawer {
    width: min(100vw, 460px);
    background: #ffffff;
    box-shadow: -14px 0 28px rgba(16, 24, 40, 0.12);
}

.empresas-drawer .input {
    background: #f5f7fa;
    border-color: #d5dce5;
    border-radius: 8px;
}

.empresas-drawer-actions .btn {
    background: transparent;
    border: 0;
    padding: 4px 0;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

#empresa-edit-cancel {
    color: #6f7884;
}

#empresa-edit-cancel:hover {
    color: #5f6874;
    background: rgba(111, 120, 132, 0.08);
    text-decoration: underline;
    text-underline-offset: 2px;
}

.empresas-drawer-actions .btn-primary {
    color: #0094b8;
}

.empresas-drawer-actions .btn-primary:hover {
    color: #007b96;
    background: rgba(0, 170, 209, 0.08);
    text-decoration: underline;
    text-underline-offset: 2px;
}

@media (max-width: 900px) {
    .empresas-page .empresas-search {
        flex: 1 1 100%;
        width: 100%;
    }
}

/* Empresas micro-refinements */
.empresas-panel th,
.empresas-panel td {
    padding: 14px 18px;
}

.empresas-page .empresa-row {
    cursor: pointer;
}

.empresas-page .empresa-row td {
    transition: background-color 150ms ease;
}

.empresas-page .empresa-row:hover td {
    background: #f5f7fa;
}

.empresas-drawer {
    box-shadow: -20px 0 44px rgba(16, 24, 40, 0.16);
}

/* Empresas micro UI polish (etapa 3) */
.empresas-page h1 {
    font-weight: 680;
    letter-spacing: -0.01em;
    color: #1e2a36;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

.empresas-page .empresas-search {
    flex: 0 0 300px;
    width: 300px;
    max-width: 100%;
}

.empresas-page .input,
.empresas-drawer .input {
    font-size: 15px;
    line-height: 1.35;
    min-height: 42px;
    padding: 10px 12px;
}

.empresas-page .input::placeholder,
.empresas-drawer .input::placeholder {
    font-size: 13px;
    color: #a5aeb8;
}

.empresas-page .action-link,
.empresas-drawer-actions .btn,
.empresas-drawer .btn-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    text-decoration: none;
}

.empresas-page .action-link {
    color: var(--green);
    font-size: 0.95rem;
    font-weight: 600;
}

.empresas-page .action-link:hover {
    color: #0094b8;
    background: rgba(0, 170, 209, 0.06);
    border-color: rgba(0, 170, 209, 0.2);
    text-decoration: none;
}

.empresas-page .action-link:focus-visible,
.empresas-drawer-actions .btn:focus-visible,
.empresas-drawer .btn-close:focus-visible {
    outline: 1px solid #98a2ad;
    outline-offset: 0;
    text-decoration: none;
}

.empresas-panel th,
.empresas-panel td {
    padding: 14px 18px;
}

.empresas-panel thead th {
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: #64748b;
}

.empresas-panel tbody td {
    font-size: 0.97rem;
    font-weight: 550;
    color: #34414e;
}

.empresas-page .empresa-row {
    cursor: pointer;
}

.empresas-page .empresa-row td {
    transition: background-color 160ms ease;
}

.empresas-page .empresa-row:hover td {
    background: #f2f5f8;
}

.empresas-drawer {
    background: #f4f6f8;
}

.empresas-drawer .input {
    background: #ffffff;
    border-color: #d5dde6;
}

.empresas-drawer .input:focus,
.empresas-drawer .input:focus-visible {
    border-color: #9aa5b0;
    outline: 1px solid #9aa5b0;
    outline-offset: 0;
    box-shadow: none;
}

.empresas-drawer-header {
    margin-bottom: 10px;
}

.drawer-divider {
    border-top: 1px solid #d7dee7;
}

.empresas-drawer-actions .btn {
    font-size: 0.95rem;
    font-weight: 600;
}

#empresa-edit-cancel {
    color: #6a7480;
}

#empresa-edit-cancel:hover {
    color: #5e6773;
    background: rgba(106, 116, 128, 0.08);
    border-color: rgba(106, 116, 128, 0.2);
    text-decoration: none;
}

.empresas-drawer-actions .btn-primary {
    color: var(--green);
}

.empresas-drawer-actions .btn-primary:hover {
    color: #0094b8;
    background: rgba(0, 170, 209, 0.06);
    border-color: rgba(0, 170, 209, 0.2);
    text-decoration: none;
}

#empresa-edit-cancel::before,
.empresas-drawer-actions .btn-primary::before {
    content: none;
}

.empresas-drawer .input.input-error,
.empresas-drawer .input.input-error:focus,
.empresas-drawer .input.input-error:focus-visible {
    border-color: #d88484;
    outline: 1px solid #d88484;
    box-shadow: none;
}

.empresas-page .empresas-header-row {
    justify-content: flex-end;
    margin-bottom: 8px;
}

/* Configuracoes */
.settings-page {
    display: grid;
    gap: 16px;
    width: 100%;
    margin: 0;
}

.settings-card {
    margin-bottom: 0;
}

.settings-card-head {
    margin-bottom: 14px;
}

.settings-card-head h2 {
    margin-bottom: 2px;
}

.settings-profile {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 14px;
    align-items: flex-start;
}

.settings-avatar {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    border: 1px solid #cbd5e1;
    overflow: hidden;
    background: linear-gradient(180deg, #f8fbff 0%, #eef4ff 100%);
    display: inline-grid;
    place-items: center;
}

.settings-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.settings-avatar-fallback {
    font-size: 1.05rem;
    font-weight: 650;
    color: #475569;
}

.settings-avatar.is-fallback img {
    display: none;
}

.settings-avatar:not(.is-fallback) .settings-avatar-fallback {
    display: none;
}

.settings-profile-fields {
    margin: 0;
}

.settings-profile-main {
    display: grid;
    gap: 12px;
}

.settings-avatar-form {
    margin-top: 2px;
}

.settings-avatar-input {
    display: none;
}

.settings-avatar-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.settings-avatar-hint {
    margin: 10px 0 0;
    color: #6c7784;
    font-size: 0.86rem;
}

.settings-avatar-hint.error {
    color: #b64949;
}

.settings-hint {
    margin: 10px 0 0;
    color: #6c7784;
    font-size: 0.88rem;
}

.settings-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-start;
    gap: 10px;
}

.settings-readonly-grid {
    display: grid;
    gap: 0;
}

.settings-readonly-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 12px 0;
    border-bottom: 1px solid #e4e8ee;
}

.settings-readonly-label {
    color: #6b7280;
    font-size: 0.82rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
}

.settings-readonly-value {
    color: #1b2733;
    font-weight: 600;
    text-align: right;
}

.backlog-page {
    display: grid;
    gap: 16px;
    width: 100%;
}

.backlog-panel {
    min-height: calc(100vh - 180px);
}

.backlog-toolbar {
    margin-bottom: 18px;
}

.backlog-search {
    width: min(560px, 100%);
}

.backlog-empty-state {
    min-height: 360px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 12px;
    border: 1px dashed #dbe4ef;
    border-radius: 14px;
    background: #fbfdff;
    text-align: center;
    padding: 32px 20px;
}

.backlog-empty-icon {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    background: rgba(0, 170, 209, 0.08);
    color: #00aad1;
    font-size: 1.15rem;
}

.backlog-empty-title {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 700;
    color: #0f172a;
}

.backlog-empty-text {
    margin: 0;
    max-width: 58ch;
    color: #64748b;
    line-height: 1.6;
}

.settings-alert {
    border: 1px solid #d7e3da;
    background: #edf6f1;
    color: #0094b8;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.92rem;
    font-weight: 550;
}

.settings-alert.error {
    border-color: #eed2d2;
    background: #fff1f1;
    color: #b64949;
}

@media (max-width: 900px) {
    .settings-profile {
        grid-template-columns: 1fr;
    }
}

/* Empresas SaaS premium polish (etapa 6) */
.empresas-page .empresas-search {
    position: relative;
    width: 340px;
    max-width: 100%;
    flex: 0 0 auto;
}

.empresas-page .empresas-search::before {
    content: "\f002";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.8rem;
    color: #96a1ac;
    pointer-events: none;
}

.empresas-page .empresas-search .input {
    padding-left: 34px;
    padding-right: 34px;
    height: 40px;
}

.empresas-page .empresas-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: nowrap;
}

.empresas-toolbar-actions {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-left: auto;
}

.empresas-export {
    position: relative;
}

.empresas-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 20px;
    height: 20px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: #8995a2;
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    display: inline-grid;
    place-items: center;
}

.empresas-search-clear:hover,
.empresas-search-clear:focus-visible {
    background: #eef3f7;
    color: #61707f;
    outline: none;
}

.toolbar-btn {
    height: 40px;
    padding: 0 14px;
    border-radius: 10px;
    border: 1px solid transparent;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.toolbar-btn i {
    font-size: 0.82rem;
}

.toolbar-btn:hover,
.toolbar-btn:focus-visible {
    text-decoration: none;
    outline: none;
}

.toolbar-btn-secondary {
    background: #fff;
    color: #42505e;
    border-color: #d7dfe7;
}

.toolbar-btn-secondary:hover,
.toolbar-btn-secondary:focus-visible {
    background: #f7fafc;
    border-color: #c7d0da;
}

.toolbar-btn-primary {
    background: var(--green);
    color: #fff;
    border-color: var(--green);
    box-shadow: 0 6px 16px rgba(0, 170, 209, 0.2);
}

.toolbar-btn-primary:hover,
.toolbar-btn-primary:focus-visible {
    background: #0094b8;
    border-color: #0094b8;
}

.empresas-export-caret {
    font-size: 0.68rem;
    color: #7a8794;
}

.toolbar-btn-primary .empresas-export-caret,
.toolbar-btn-primary i {
    color: inherit;
}

.empresas-export-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    min-width: 220px;
    padding: 6px;
    border: 1px solid #e0e6ed;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 12px 26px rgba(18, 28, 39, 0.1);
    z-index: 20;
}

.empresas-export-option {
    width: 100%;
    border: 0;
    background: transparent;
    padding: 9px 10px;
    border-radius: 8px;
    color: #42505e;
    font-size: 0.9rem;
    font-weight: 540;
    text-align: left;
    cursor: pointer;
}

.empresas-export-option:hover,
.empresas-export-option:focus-visible {
    background: #f5f8fa;
    outline: none;
}

.empresas-panel {
    min-height: 220px;
}

.empresas-panel thead th {
    font-size: 0.76rem;
    letter-spacing: 0.07em;
    font-weight: 620;
}

.empresas-sortable-col {
    white-space: nowrap;
}

.empresas-sort-btn {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    padding: 0;
    border: 0;
    background: transparent;
    color: inherit;
    font: inherit;
    letter-spacing: inherit;
    text-transform: inherit;
    cursor: pointer;
    text-decoration: none;
}

.empresas-sort-btn:hover,
.empresas-sort-btn:focus-visible {
    text-decoration: none;
}

.empresas-sort-btn:focus-visible {
    outline: 1px solid #a5afba;
    outline-offset: 2px;
    border-radius: 4px;
}

.empresas-sort-btn .sort-icon {
    font-size: 0.7rem;
    color: #98a4b0;
}

.empresas-sort-btn[data-direction="asc"] .sort-icon,
.empresas-sort-btn[data-direction="desc"] .sort-icon {
    color: #5f6a76;
}

.empresas-panel tbody td {
    font-size: 0.96rem;
    font-weight: 540;
    transition: background-color 180ms ease, color 180ms ease;
}

.empresas-panel th,
.empresas-panel td {
    padding: 15px 18px;
}

.empresas-panel tbody tr:nth-child(even) td {
    background: #fbfcfd;
}

.empresa-action-head,
.empresa-action-cell {
    width: 34px;
    padding-left: 8px;
    padding-right: 12px;
    text-align: right;
}

.table-row-clickable {
    cursor: pointer;
}

.table-row-clickable:focus-visible td {
    outline: 1px solid #a5afba;
    outline-offset: -1px;
}

.empresa-action-cell {
    pointer-events: none;
}

.empresa-row-chevron {
    opacity: 0;
    transform: translateX(-6px);
    color: #94a0ad;
    font-size: 0.72rem;
    transition: opacity 170ms ease, transform 170ms ease;
}

.table-row-clickable:hover .empresa-row-chevron,
.table-row-clickable:focus-visible .empresa-row-chevron {
    opacity: 0.95;
    transform: translateX(0);
}

.empresas-page .empresa-row:hover td {
    background: #f4f7fb;
}

.empresas-page .empresa-cnpj-cell {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.empresas-summary {
    margin: 2px 0 12px;
    font-size: 0.9rem;
    color: #64717d;
    font-weight: 560;
}

.empresas-summary-meta {
    width: 100%;
    margin: 8px 2px 0;
    text-align: right;
    font-size: 0.82rem;
    color: #8894a0;
    font-weight: 540;
}

.empresas-empty-state,
.empresas-no-results {
    min-height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    flex-direction: column;
    gap: 10px;
    color: #63707d;
}

.empresas-empty-state.hidden,
.empresas-no-results.hidden {
    display: none;
}

.empresas-empty-icon {
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid #dde4eb;
    display: inline-grid;
    place-items: center;
    font-size: 1.1rem;
    background: #f9fbfc;
}

.empresas-empty-title,
.empresas-no-results p {
    margin: 0;
    font-size: 0.96rem;
}

.empresas-empty-cta,
.empresas-clear-search {
    text-decoration: none;
}

.empresas-empty-cta:hover,
.empresas-clear-search:hover {
    text-decoration: none;
}

.empresas-no-results strong {
    color: #394654;
    font-weight: 620;
}

@media (max-width: 900px) {
    .empresas-page .empresas-toolbar {
        flex-wrap: wrap;
    }

    .empresas-page .empresas-search {
        width: 100%;
        flex-basis: 100%;
    }

    .empresas-toolbar-actions {
        width: 100%;
        justify-content: flex-end;
    }

    .empresas-summary-meta {
        text-align: left;
    }
}

/* Empresas drawer actions and divider (SaaS) */
.empresas-drawer {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding: 0;
    overflow: hidden;
}

.empresas-drawer-header {
    flex: 0 0 auto;
    margin-bottom: 0;
    padding: 18px 16px 10px;
}

.empresas-drawer-body {
    flex: 1 1 auto;
    overflow-y: auto;
    padding: 0 16px 18px;
}

.empresas-drawer .input {
    min-height: 42px;
    line-height: 1.35;
    transition: border-color 150ms ease, box-shadow 150ms ease, background-color 150ms ease;
}

.empresas-drawer .input:focus,
.empresas-drawer .input:focus-visible {
    border-color: #9aa3af;
    outline: none;
    box-shadow: 0 0 0 1px #9aa3af;
}

.empresas-drawer .drawer-divider {
    border: 0;
    border-top: 1px solid #e6e9ef;
    margin-top: 18px;
    margin-bottom: 14px;
}

.empresas-drawer-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

.empresas-drawer-actions .btn-ghost {
    background: #f3f5f8;
    border-color: #d8dee7;
    color: #5f6a76;
}

.empresas-drawer-actions .btn-ghost:hover {
    background: #e9edf2;
    border-color: #cfd7e1;
    color: #4f5964;
    text-decoration: none;
}

.empresas-drawer-actions .btn-primary {
    background: var(--green);
    border-color: var(--green);
    color: #fff;
    box-shadow: 0 1px 3px rgba(0, 170, 209, 0.22);
}

.empresas-drawer-actions .btn-primary:hover {
    background: #0094b8;
    border-color: #0094b8;
    color: #fff;
    text-decoration: none;
}

.empresas-drawer-actions .btn-conta-new {
    background: #eef4fb;
    border-color: #c7d8ee;
    color: #2f5f96;
    box-shadow: 0 1px 2px rgba(47, 95, 150, 0.12);
}

.empresas-drawer-actions .btn-conta-new:hover {
    background: #e3edf8;
    border-color: #b9cde8;
    color: #274f7c;
    text-decoration: none;
}

.empresas-drawer-actions .btn,
.empresas-drawer .btn-close {
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

/* Contas a Pagar */
.drawer--contas-pagar {
    width: 75vw;
    min-width: 520px;
    max-width: 75vw;
}

.contas-pagar-page .contas-filters-row {
    margin-top: 10px;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr)) auto;
    gap: 10px;
    align-items: end;
}

.contas-pagar-page .contas-filters-row label {
    margin: 0;
}

.contas-pagar-page .contas-filters-row .input {
    height: 40px;
}

.contas-pagar-page .contas-filters-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
}

.contas-pagar-page .contas-filters-actions .toolbar-btn {
    min-width: 116px;
}

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

.contas-drawer .form-grid > * {
    min-width: 0;
}

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

.contas-drawer .form-block {
    margin-bottom: 16px;
}

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

.contas-drawer .form-grid.form-grid-3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.contas-drawer .form-grid.form-grid-4 {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.contas-drawer .form-grid.form-grid-6 {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.contas-drawer .form-grid.form-grid-8 {
    grid-template-columns: repeat(8, minmax(0, 1fr));
}

.contas-drawer .contas-col-span-2 {
    grid-column: span 2;
}

.contas-drawer .contas-pay-grid {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1.8fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.15fr) minmax(0, 1.15fr);
    gap: 12px;
}

.contas-drawer .drawer-form-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.contas-drawer .drawer-form-row-single {
    grid-template-columns: 1fr;
}

.contas-drawer .drawer-form-row-single .input {
    width: 100%;
}

.contas-subfav-section {
    border: 1px solid #e6ebf0;
    border-radius: 12px;
    background: #f9fbfc;
    padding: 12px;
    position: relative;
    z-index: 6;
}

.contas-subfav-table-wrap {
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    overflow: visible;
    background: #fff;
    position: relative;
    isolation: isolate;
}

.contas-subfav-table {
    width: 100%;
    border-collapse: separate;
    table-layout: auto;
    min-width: 0;
    border-spacing: 0;
}

.contas-subfav-col-sub-struct {
    width: 34%;
}

.contas-subfav-col-category-struct {
    width: 26%;
}

.contas-subfav-col-value-struct {
    width: 24%;
}

.contas-subfav-col-actions-struct {
    width: 16%;
}

.contas-subfav-table thead th {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.05em;
    color: #6d7884;
    background: #f5f8fa;
    padding: 9px 10px;
    border-bottom: 1px solid #e5ebf1;
}

.contas-subfav-table th,
.contas-subfav-table td {
    text-align: left;
    box-sizing: border-box;
    overflow: visible;
}

.contas-subfav-col-sub-head,
.contas-subfav-col-sub {
    width: auto;
}

.contas-subfav-col-value-head,
.contas-subfav-col-value {
    width: auto;
}

.contas-subfav-col-category-head,
.contas-subfav-col-category {
    width: auto;
}

.contas-subfav-table tbody td {
    padding: 8px 10px;
    border-bottom: 1px solid #edf1f5;
    vertical-align: top;
}

.contas-subfav-table tbody tr:last-child td {
    border-bottom: 0;
}

.contas-subfav-col-sub {
    position: relative;
    z-index: 30;
}

.contas-subfav-col-category {
    position: relative;
    z-index: 28;
}

.contas-subfav-col-value {
    width: auto;
}

.contas-subfav-action-head,
.contas-subfav-col-actions {
    width: 132px;
    min-width: 132px;
    max-width: 132px;
    text-align: center;
    padding-left: 0;
    padding-right: 0;
    white-space: nowrap;
}

.contas-subfav-col-actions {
    vertical-align: middle;
}

.contas-subfav-col-actions .contas-subfav-actions-wrap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    flex-wrap: nowrap;
    gap: 6px;
}

.contas-subfav-col-actions .contas-subfav-row-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    min-width: 32px;
    height: 32px;
    padding: 0;
    border: 1px solid #d8dfe7;
    border-radius: 8px;
    background: #fff;
    color: #4f5c67;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.contas-subfav-col-actions .contas-subfav-row-action:hover {
    background: #eef4ff;
    border-color: #cfd8e2;
}

.contas-subfav-col-actions .contas-subfav-row-action.hidden {
    display: none !important;
}

.contas-subfav-col-actions .contas-subfav-row-action.is-remove {
    color: #5d6975;
}

.contas-subfav-col-actions .contas-subfav-row-action i {
    pointer-events: none;
    line-height: 1;
}

.contas-subfav-col-actions .contas-subfav-row-action.is-busy {
    opacity: 0.55;
    cursor: wait;
}

.contas-subfav-col-sub .entity-autocomplete {
    position: relative;
    z-index: 180 !important;
}

.contas-subfav-col-sub .entity-autocomplete .entity-autocomplete-menu {
    z-index: 240 !important;
}

.contas-subfav-col-category .entity-autocomplete {
    position: relative;
    z-index: 170 !important;
}

.contas-subfav-col-category .entity-autocomplete .entity-autocomplete-menu {
    z-index: 230 !important;
}

.contas-subfav-col-value .input,
.contas-subfav-col-sub .input,
.contas-subfav-col-category .input {
    width: 100%;
    min-width: 0;
}

.contas-subfav-remove {
    width: 32px;
    height: 32px;
    border: 1px solid #d8dfe7;
    border-radius: 8px;
    background: #fff;
    color: #5f6a76;
    cursor: pointer;
    transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.contas-subfav-remove:hover {
    background: #eef4ff;
    border-color: #cfd8e2;
}

.contas-subfav-add {
    margin-top: 10px;
}

.contas-subfav-summary {
    margin-top: 10px;
    display: grid;
    gap: 4px;
    font-size: 0.83rem;
    color: #5f6a76;
}

.contas-subfav-summary p {
    margin: 0;
}

.contas-subfav-summary strong {
    color: #3d4c5a;
    font-variant-numeric: tabular-nums;
}

.contas-subfav-summary.is-ok #conta-subfav-diferenca {
    color: #00aad1;
}

.contas-subfav-summary.is-warn #conta-subfav-diferenca {
    color: #b26d1e;
}

.contas-drawer .form-row--parcelado {
    margin-top: 12px;
    margin-bottom: 10px;
}

.contas-drawer .parcelamento-toggle-row {
    margin: 12px 0 14px;
}

.contas-drawer .chk-inline--parcelamento {
    display: inline-flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 10px !important;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    width: auto !important;
    max-width: 100%;
    text-align: left !important;
    margin: 0;
}

.contas-drawer .chk-inline--parcelamento input[type="checkbox"] {
    margin: 0 !important;
    flex: 0 0 auto;
    width: auto !important;
}

.contas-drawer .chk-inline--parcelamento span {
    display: inline-block !important;
    line-height: 1.2;
    margin: 0 !important;
}

.contas-drawer .checkbox-inline {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: nowrap;
}

.contas-drawer .contas-parcelamento-wrap {
    border: 1px solid #e6ebf0;
    border-radius: 12px;
    background: #f9fbfc;
    padding: 12px;
    display: grid;
    gap: 12px;
    overflow-x: hidden;
}

.contas-drawer .parcelamento-modos-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.contas-drawer .parcelamento-modo {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 14px 16px;
    border: 1px solid #d9e1ea;
    border-radius: 14px;
    min-height: 72px;
    line-height: 1.35;
    margin: 0;
    color: #475569;
    font-weight: 500;
    background: #fff;
}

.contas-drawer .parcelamento-modo.is-selected {
    background: #eef8f4;
    border-color: #4b9b7c;
    box-shadow: 0 0 0 2px rgba(75, 155, 124, 0.1);
}

.contas-drawer .parcelamento-modo span {
    display: block;
    white-space: normal;
    word-break: normal;
}

.contas-drawer .parcelamento-modo input[type="radio"] {
    margin-top: 2px;
    flex: 0 0 auto;
}

.contas-drawer .contas-parcelamento-readonly {
    border: 1px solid #e3e8ef;
    border-radius: 10px;
    background: #fff;
    padding: 10px 12px;
}

.contas-drawer .contas-parcelamento-readonly p {
    margin: 0 0 4px;
    font-size: 0.78rem;
    color: #6b7783;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.contas-drawer .contas-parcelamento-readonly strong {
    color: #334455;
    font-size: 0.95rem;
}

.contas-drawer .contas-parcelamento-preview {
    border-top: 1px solid #e7ecf2;
    padding-top: 10px;
}

.contas-drawer .contas-parcelamento-title {
    margin: 0 0 6px;
    color: #5f6b77;
    font-size: 0.85rem;
    font-weight: 600;
}

.contas-drawer .contas-parcelamento-preview ul {
    margin: 0;
    padding-left: 16px;
    display: grid;
    gap: 4px;
    color: #42505d;
    font-size: 0.86rem;
}

.contas-drawer #conta-valor-parcela-wrap.hidden {
    display: none;
}

.contas-drawer #conta-apply-group-wrap {
    margin-top: 0;
}

.contas-drawer #conta-apply-group-wrap .switch-inline {
    width: 100%;
    white-space: normal;
    line-height: 1.35;
}

.contas-drawer .entity-autocomplete {
    position: relative;
}

.contas-drawer .entity-autocomplete-row {
    display: block;
}

.contas-drawer .entity-autocomplete-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 210px;
    overflow: auto;
    border: 1px solid #d7dfe7;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(18, 28, 39, 0.12);
    padding: 6px;
}

.contas-drawer .entity-autocomplete-item,
.contas-drawer .entity-autocomplete-create {
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 8px;
    min-height: 34px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #44515e;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
}

.contas-drawer .entity-autocomplete-item:hover,
.contas-drawer .entity-autocomplete-item.is-active,
.contas-drawer .entity-autocomplete-create:hover {
    background: #f4f7fa;
}

.contas-drawer .entity-autocomplete-create {
    color: #2c7d5a;
    font-weight: 600;
}

.contas-drawer .entity-autocomplete-divider {
    height: 1px;
    margin: 6px 4px;
    background: #e6ebf0;
}

.contas-drawer-section {
    margin-top: 12px;
    padding: 12px;
    border: 1px solid #e6ebf0;
    border-radius: 12px;
    background: #f9fbfc;
    display: grid;
    gap: 10px;
}

.contas-drawer-section-title {
    margin: 0;
    font-size: 0.86rem;
    font-weight: 620;
    color: #5e6a76;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.contas-inline-actions {
    justify-content: flex-end;
}

.contas-drawer .conta-file-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid #d5dee8;
    border-radius: 10px;
    background: #fff;
}

.contas-drawer .conta-file-picker.is-dragover {
    border-color: #4f8cff;
    background: #f3f8ff;
}

.contas-drawer .conta-file-picker .btn {
    margin: 0;
    height: 34px;
    padding: 0 12px;
    flex: 0 0 auto;
}

.contas-drawer .conta-file-picker-name {
    min-width: 0;
    color: #5f6b77;
    font-size: 0.9rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contas-drawer #conta-edit-boleto-row .form-help {
    margin: 0;
    font-size: 0.8rem;
    color: #6f7b87;
}

.contas-drawer #conta-edit-anexo-row .form-help,
.contas-drawer #conta-receber-anexo-row .form-help {
    margin: 0;
    font-size: 0.8rem;
    color: #6f7b87;
}

.contas-drawer #conta-receber-xml-import-row .form-help {
    margin: 0;
    font-size: 0.8rem;
    color: #6f7b87;
}

.contas-drawer #conta-edit-boleto-row .btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.contas-drawer #conta-edit-anexo-row .btn:disabled,
.contas-drawer #conta-receber-anexo-row .btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.contas-drawer #conta-receber-xml-import-row .btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.contas-anexos-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: -2px;
}

.contas-anexos-list.hidden {
    display: none;
}

.contas-anexo-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    max-width: 100%;
    padding: 5px 10px;
    border: 1px solid #d5dee8;
    border-radius: 999px;
    background: #fff;
    color: #2c3a49;
    font-size: 0.82rem;
    text-decoration: none;
    line-height: 1.25;
}

.contas-anexo-link:hover {
    border-color: #b8c6d5;
    background: #f4f8fb;
}

.contas-anexo-link-name {
    max-width: 260px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.inline-create-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(18, 27, 38, 0.32);
    z-index: 1130;
}

.inline-create-modal {
    position: fixed;
    right: 40px;
    top: 92px;
    width: min(480px, calc(100vw - 24px));
    max-height: calc(100vh - 120px);
    overflow: auto;
    background: #fff;
    border: 1px solid #dbe3ea;
    border-radius: 14px;
    box-shadow: 0 22px 42px rgba(18, 28, 39, 0.2);
    z-index: 1140;
}

.inline-create-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px 8px;
}

.inline-create-modal-header h3 {
    margin: 0;
    font-size: 1rem;
    color: #314252;
}

.inline-create-modal-body {
    padding: 0 16px 16px;
}

.inline-create-modal .entity-autocomplete {
    position: relative;
}

.inline-create-modal .entity-autocomplete-row {
    display: block;
}

.inline-create-modal .entity-autocomplete-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 1160;
    max-height: 210px;
    overflow: auto;
    border: 1px solid #d7dfe7;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(18, 28, 39, 0.12);
    padding: 6px;
}

.inline-create-modal .entity-autocomplete-item,
.inline-create-modal .entity-autocomplete-create {
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 8px;
    min-height: 34px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #44515e;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
}

.inline-create-modal .entity-autocomplete-item:hover,
.inline-create-modal .entity-autocomplete-item.is-active,
.inline-create-modal .entity-autocomplete-create:hover {
    background: #f4f7fa;
}

.inline-create-modal .entity-autocomplete-create {
    color: #2c7d5a;
    font-weight: 600;
}

.inline-create-modal .entity-autocomplete-divider {
    height: 1px;
    margin: 6px 4px;
    background: #e6ebf0;
}

@media (max-width: 900px) {
    .drawer--contas-pagar {
        width: 100vw;
        min-width: 0;
        max-width: 100vw;
    }

    .contas-pagar-page .contas-filters-row {
        grid-template-columns: 1fr;
    }

    .contas-pagar-page .contas-filters-actions {
        justify-content: flex-start;
    }

    .contas-drawer .form-grid {
        grid-template-columns: 1fr;
    }

    .contas-drawer .contas-entity-grid,
    .contas-drawer .form-grid.form-grid-2,
    .contas-drawer .form-grid.form-grid-3,
    .contas-drawer .form-grid.form-grid-4,
    .contas-drawer .form-grid.form-grid-6,
    .contas-drawer .form-grid.form-grid-8,
    .contas-drawer .contas-pay-grid,
    .contas-drawer .drawer-form-row,
    .contas-drawer .drawer-form-row-single {
        grid-template-columns: 1fr;
    }

    .contas-drawer .contas-col-span-2 {
        grid-column: auto;
    }

    .contas-drawer .parcelamento-modos-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .contas-subfav-table,
    .contas-subfav-table thead,
    .contas-subfav-table tbody,
    .contas-subfav-table tr,
    .contas-subfav-table th,
    .contas-subfav-table td {
        display: block;
        width: 100%;
    }

    .contas-subfav-table thead {
        display: none;
    }

    .contas-subfav-table tbody td {
        border-bottom: 0;
        padding: 8px 10px 0;
    }

    .contas-subfav-table tbody td:last-child {
        padding-bottom: 10px;
    }

    .contas-subfav-col-actions {
        text-align: left;
    }

    .inline-create-modal {
        right: 12px;
        top: 76px;
        width: calc(100vw - 24px);
        max-height: calc(100vh - 92px);
    }
}

/* Favorecidos */
.favorecidos-page .favorecido-document-cell {
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.01em;
}

.favorecidos-toolbar-left {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    min-width: 0;
    flex: 1;
}

.favorecidos-page .empresas-toolbar-actions {
    align-self: flex-end;
}

.favorecidos-toolbar-left .empresas-search {
    margin: 0;
    width: min(360px, 100%);
}

.favorecidos-filter-inline {
    display: grid;
    gap: 6px;
    min-width: 140px;
    max-width: 180px;
    margin: 0;
    color: #6e7a86;
    font-size: 0.9rem;
}

.favorecidos-filter-inline .input {
    min-height: 42px;
}

.favorecidos-page #favorecido-edit-cpf-cnpj-error {
    min-height: 0;
    margin: 4px 0 0;
    font-size: 0.82rem;
    line-height: 1.2;
}

.favorecidos-page #favorecido-edit-cpf-cnpj-error:empty {
    display: none;
}

.favorecidos-page #favorecido-edit-telefone-error {
    min-height: 0;
    margin: 4px 0 0;
    font-size: 0.82rem;
    line-height: 1.2;
}

.favorecidos-page #favorecido-edit-telefone-error:empty {
    display: none;
}

@media (max-width: 980px) {
    .favorecidos-toolbar-left {
        width: 100%;
        flex-wrap: wrap;
        align-items: stretch;
    }

    .favorecidos-toolbar-left .empresas-search {
        width: 100%;
        max-width: 100%;
    }

    .favorecidos-filter-inline {
        min-width: 180px;
        flex: 1 1 180px;
    }
}

.favorecidos-page .entity-autocomplete {
    position: relative;
}

.favorecidos-page .entity-autocomplete-row {
    display: block;
}

.favorecidos-page .entity-autocomplete-menu {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    right: 0;
    z-index: 30;
    max-height: 210px;
    overflow: auto;
    border: 1px solid #d7dfe7;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 10px 26px rgba(18, 28, 39, 0.12);
    padding: 6px;
}

.favorecidos-page .entity-autocomplete-item,
.favorecidos-page .entity-autocomplete-create {
    width: 100%;
    border: 0;
    background: transparent;
    border-radius: 8px;
    min-height: 34px;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #44515e;
    font-size: 0.9rem;
    text-align: left;
    cursor: pointer;
}

.favorecidos-page .entity-autocomplete-item:hover,
.favorecidos-page .entity-autocomplete-item.is-active,
.favorecidos-page .entity-autocomplete-create:hover {
    background: #f4f7fa;
}

.favorecidos-page .entity-autocomplete-create {
    color: #2c7d5a;
    font-weight: 600;
}

.favorecidos-page .entity-autocomplete-divider {
    height: 1px;
    margin: 6px 4px;
    background: #e6ebf0;
}

/* Assistente de Importação */
.importar-page {
    display: grid;
    gap: 14px;
}

.importar-help h2 {
    margin: 0 0 8px;
    font-size: 1.2rem;
    color: #2d3a46;
}

.importar-help p {
    margin: 0 0 8px;
    color: #566474;
    font-size: 0.95rem;
    line-height: 1.45;
}

.importar-grid-top {
    grid-template-columns: minmax(220px, 1fr) minmax(180px, 220px) minmax(260px, 1.35fr);
    align-items: end;
}

.importar-actions {
    margin-top: 12px;
    flex-wrap: wrap;
    justify-content: flex-start;
}

.importar-page .importar-file-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    height: 44px;
    padding: 4px 10px;
    border: 1px solid #d5dee8;
    border-radius: 10px;
    background: #fff;
    transition: border-color 150ms ease, background-color 150ms ease;
    box-sizing: border-box;
}

.importar-page .importar-file-picker.is-dragover {
    border-color: #4f8cff;
    background: #f3f8ff;
}

.importar-page .importar-file-picker .btn {
    margin: 0;
    height: 30px;
    min-height: 30px;
    padding: 0 12px;
    flex: 0 0 auto;
}

.importar-page .conta-file-picker-name {
    min-width: 0;
    color: #5f6b77;
    font-size: 0.9rem;
    line-height: 1.1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.importar-page .importar-file-help {
    margin: 6px 0 0;
    font-size: 0.8rem;
    color: #6f7b87;
}

.disabled-link {
    opacity: 0.6;
    pointer-events: none;
    text-decoration: none;
}

.importar-orientacao h3 {
    margin: 0 0 8px;
    font-size: 1.05rem;
    color: #2e3b47;
}

.importar-orientacao ul {
    margin: 0 0 10px;
    padding-left: 20px;
    color: #52606f;
    font-size: 0.9rem;
}

.importar-campos {
    margin: 4px 0;
    color: #5c6a78;
    font-size: 0.88rem;
}

.importar-kpis {
    display: grid;
    grid-template-columns: repeat(6, minmax(120px, 1fr));
    gap: 10px;
    margin-bottom: 12px;
}

.importar-kpi {
    border: 1px solid #d9e1ea;
    border-radius: 10px;
    padding: 10px 12px;
    background: #fff;
}

.importar-kpi span {
    display: block;
    color: #6b7a88;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.importar-kpi strong {
    display: block;
    color: #2b3946;
    font-size: 1.3rem;
    margin-top: 2px;
}

.importar-status-badge {
    display: inline-flex;
    align-items: center;
    min-height: 24px;
    border-radius: 999px;
    padding: 2px 10px;
    border: 1px solid #d8e1ea;
    background: #f4f7fb;
    color: #5b6775;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.importar-status-badge.is-valid {
    background: #ecf8f2;
    border-color: #d4eadc;
    color: #0094b8;
}

.importar-status-badge.is-warning {
    background: #fff7e9;
    border-color: #f0dfb7;
    color: #946f1f;
}

.importar-status-badge.is-error {
    background: #fdeff0;
    border-color: #f2d8dc;
    color: #c24444;
}

.importar-empty-cell {
    text-align: center;
    color: #7a8795;
    padding: 18px;
}

.importar-historico-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.importar-historico-header h3 {
    margin: 0;
}

@media (max-width: 1280px) {
    .importar-kpis {
        grid-template-columns: repeat(3, minmax(120px, 1fr));
    }
}

@media (max-width: 980px) {
    .importar-grid-top {
        grid-template-columns: 1fr;
    }

    .importar-kpis {
        grid-template-columns: repeat(2, minmax(120px, 1fr));
    }
}

@media (max-width: 640px) {
    .importar-kpis {
        grid-template-columns: 1fr;
    }
}

/* Usuarios */
.usuarios-status {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.78rem;
    font-weight: 600;
    line-height: 1;
}

.usuarios-status.is-active {
    background: #edf6f1;
    border-color: #d6e9df;
    color: #0094b8;
}

.usuarios-status.is-inactive {
    background: #f5f7fa;
    border-color: #e3e8ef;
    color: #63717f;
}

.usuarios-active-toggle {
    margin: 2px 0 4px;
    color: #5f6c78;
    font-weight: 600;
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    width: fit-content;
    align-self: flex-start;
}

.usuarios-active-toggle span {
    line-height: 1;
    white-space: nowrap;
}

.usuarios-reset-section {
    margin-top: 6px;
    padding: 12px;
    border: 1px solid #dfe5ec;
    border-radius: 10px;
    background: #f7f9fb;
}

.usuarios-reset-title {
    margin: 0 0 10px;
    color: #435060;
    font-size: 0.9rem;
    font-weight: 650;
}

.usuarios-reset-actions {
    justify-content: flex-start;
    margin-top: 10px;
}

/* Font rendering consistency (final precedence) */
table,
.table,
.table th,
.table td,
th,
td {
    font-family: var(--font-sans) !important;
    font-weight: 500;
    letter-spacing: 0;
    font-kerning: normal;
    text-rendering: geometricPrecision;
}

.table thead th,
table thead th {
    font-weight: 600;
}

/* Relatorio Contas a Pagar */
.relatorio-pagar-page {
    display: grid;
    gap: 12px;
}

.relatorio-cards-grid {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.relatorio-card {
    min-width: 0;
    padding: 10px 12px;
    border: 1px solid #e2e8ef;
    background: #ffffff;
    border-radius: 10px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
    min-height: 78px;
}

.relatorio-card-head {
    margin: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: #6f7c89;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.relatorio-card-head i {
    font-size: 0.72rem;
}

.relatorio-card-value {
    margin: 4px 0 0;
    color: #2f3c48;
    font-size: 1.65rem;
    line-height: 1.05;
    font-weight: 700;
}

.relatorio-card-meta {
    margin: 2px 0 0;
    color: #7f8b97;
    font-size: 0.72rem;
}

.relatorio-filters-panel {
    padding: 10px 12px;
}

.relatorio-filters-panel form {
    display: grid;
    gap: 8px;
}

.relatorio-pagar-page .relatorio-filters-top-row {
    display: grid;
    grid-template-columns: minmax(0, 165px) minmax(0, 165px) minmax(0, 1fr);
    gap: 10px;
    align-items: end;
}

.relatorio-pagar-page .relatorio-filters-row {
    display: grid;
    grid-template-columns: repeat(5, minmax(130px, 1fr));
    gap: 8px;
    margin-top: 0;
}

.relatorio-pagar-page .relatorio-filters-top-row label,
.relatorio-pagar-page .relatorio-filters-row label {
    min-width: 0;
}

.relatorio-pagar-page .relatorio-filters-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
}

.relatorio-pagar-page .relatorio-filters-actions .toolbar-btn {
    height: 36px;
    padding: 0 12px;
    font-size: 0.95rem;
    white-space: nowrap;
}

.relatorio-pagar-page .relatorio-filters-top-row .input,
.relatorio-pagar-page .relatorio-filters-row .input {
    height: 36px;
}

.relatorio-pagar-page #relatorio-extra-filters[hidden] {
    display: none;
}

.relatorio-receber-page #relatorio-receber-extra-filters[hidden] {
    display: none;
}

.conciliacao-page {
    display: grid;
    gap: 12px;
}

.conciliacao-notice {
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 0.92rem;
    font-weight: 560;
    border: 1px solid #d9e2ec;
    background: #f7fafc;
    color: #44525f;
}

.conciliacao-notice-success {
    border-color: #b7decf;
    background: #edf8f2;
    color: #2d6d53;
}

.conciliacao-notice-error {
    border-color: #ecc2c2;
    background: #fff2f2;
    color: #8a3a3a;
}

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

.conciliacao-cards-grid .relatorio-card-value {
    font-size: 1.08rem;
    line-height: 1.2;
    white-space: nowrap;
}

.conciliacao-filters-panel {
    padding-bottom: 12px;
}

.conciliacao-filters-body {
    display: grid;
    gap: 0;
}

.conciliacao-filters-top-row {
    display: grid;
    grid-template-columns: minmax(0, 165px) minmax(0, 165px) minmax(0, 1fr) auto;
    gap: 10px;
    align-items: end;
}

.conciliacao-filters-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: nowrap;
}

.conciliacao-filters-extra-row {
    margin-top: 10px;
    display: grid;
    grid-template-columns: minmax(0, 160px) minmax(0, 160px) minmax(0, 1fr);
    gap: 10px;
    align-items: end;
}

.conciliacao-filters-extra-row[hidden] {
    display: none;
}

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

.conciliacao-main-grid > * {
    min-width: 0;
}

.conciliacao-left-panel,
.conciliacao-import-history-panel {
    padding: 10px 12px;
}

.conciliacao-suggestion-drawer {
    width: min(100vw, 50vw);
    max-width: 100vw;
    padding: 14px 14px 16px;
    display: grid;
    gap: 10px;
    align-content: start;
    grid-auto-rows: max-content;
}

.conciliacao-suggestion-drawer .drawer-header {
    margin-bottom: 2px;
}

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

.conciliacao-panel-head h3 {
    margin: 0;
    font-size: 1.02rem;
    color: #2f3c48;
}

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

.conciliacao-table-wrap table {
    min-width: 760px;
}

.conciliacao-suggestion-drawer .conciliacao-table-wrap table {
    min-width: 960px;
}

.conciliacao-row-selected td {
    background: #f1f6fb !important;
}

.conciliacao-row-clickable {
    cursor: pointer;
}

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

.conciliacao-row-clickable:focus-visible td {
    outline: 1px solid #a5afba;
    outline-offset: -1px;
}

.conciliacao-desc {
    font-weight: 560;
    color: #3a4652;
}

.conciliacao-doc {
    margin-top: 2px;
    font-size: 0.78rem;
    color: #7a8794;
}

.conciliacao-row-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.conciliacao-table-btn {
    height: 32px;
    padding: 0 10px;
    font-size: 0.8rem;
    min-width: auto;
}

.conciliacao-empty-cell {
    text-align: center;
    color: #7b8894;
    padding: 16px !important;
}

.conciliacao-selected-box {
    border: 1px solid #dde4eb;
    border-radius: 10px;
    background: #f8fbfd;
    padding: 9px 10px;
}

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

.conciliacao-selected-grid strong {
    display: block;
    color: #2f3c48;
}

.conciliacao-selected-label {
    display: block;
    margin-bottom: 4px;
    font-size: 0.72rem;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #7c8894;
    font-weight: 620;
}

.conciliacao-selected-desc {
    grid-column: 1 / -1;
}

.conciliacao-linked-box {
    margin-top: 10px;
    border: 1px solid #cfe2d9;
    border-radius: 10px;
    background: #f2faf5;
    padding: 10px;
    color: #2c5f4b;
    display: grid;
    gap: 6px;
}

.conciliacao-linked-box p {
    margin: 0;
    font-size: 0.88rem;
}

.conciliacao-linked-box form {
    margin: 0;
}

.conciliacao-linked-box .toolbar-btn {
    height: 34px;
    padding: 0 12px;
    font-size: 0.84rem;
}

.conciliacao-suggestion-filters {
    margin-top: 10px;
    display: grid;
    gap: 10px;
}

.conciliacao-suggestion-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 8px;
    align-items: end;
}

.conciliacao-suggestion-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.conciliacao-create-box {
    margin-top: 10px;
    border: 1px solid #d7e2ec;
    border-radius: 10px;
    background: #f7fafd;
    padding: 10px;
    display: grid;
    gap: 8px;
}

.conciliacao-create-title {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #4f5c69;
}

.conciliacao-create-copy {
    margin: 0;
    font-size: 0.88rem;
    color: #4d5966;
}

.conciliacao-suggestions-wrap {
    margin-top: 10px;
}

.conciliacao-options-divider {
    margin: 10px 0 8px;
    padding-top: 10px;
    border-top: 1px solid #e2e8ef;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.conciliacao-options-divider h4 {
    margin: 0;
    color: #4e5b67;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.conciliacao-more-btn {
    height: 32px;
    font-size: 0.8rem;
    padding: 0 10px;
}

.conciliacao-score {
    display: inline-flex;
    min-width: 40px;
    justify-content: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 0.78rem;
    font-weight: 650;
    color: #2f5f96;
    background: #e8f0fa;
}

.conciliacao-best-suggestion {
    margin-bottom: 8px;
    border: 1px solid #cae2d6;
    border-radius: 10px;
    background: #edf8f2;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
}

.conciliacao-best-title {
    margin: 0 0 2px;
    font-size: 0.78rem;
    font-weight: 650;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #2f6f54;
}

.conciliacao-best-copy {
    margin: 0;
    font-size: 0.88rem;
    color: #2f4d3f;
    font-weight: 560;
}

.conciliacao-best-row td {
    background: #f2faf5 !important;
}

.conciliacao-best-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 56px;
    border-radius: 999px;
    padding: 3px 8px;
    margin-bottom: 6px;
    font-size: 0.72rem;
    font-weight: 650;
    color: #2b7d5c;
    background: #ddf3e8;
}

.conciliacao-empty-state-inline {
    min-height: 240px;
}

.conciliacao-import-drawer {
    width: min(420px, 100vw);
    max-width: 100vw;
}

.conciliacao-import-drawer .conta-file-picker {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 42px;
    padding: 8px 10px;
    border: 1px solid #d5dee8;
    border-radius: 10px;
    background: #fff;
}

.conciliacao-import-drawer .conta-file-picker .btn {
    margin: 0;
    height: 34px;
    padding: 0 12px;
    flex: 0 0 auto;
}

.conciliacao-import-drawer .conta-file-picker-name {
    min-width: 0;
    color: #5f6b77;
    font-size: 0.9rem;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.conciliacao-confirm-modal {
    position: fixed;
    z-index: 1310;
    width: min(420px, calc(100vw - 28px));
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    border: 1px solid #dce4ec;
    border-radius: 12px;
    padding: 14px;
    box-shadow: 0 12px 34px rgba(16, 24, 40, 0.18);
}

#conciliacao-confirm-backdrop {
    z-index: 1300;
}

.conciliacao-confirm-modal h3 {
    margin: 0 0 8px;
    font-size: 1.02rem;
    color: #2f3c48;
}

.conciliacao-confirm-modal p {
    margin: 0;
    color: #52606d;
    font-size: 0.92rem;
}

.conciliacao-confirm-actions {
    margin-top: 14px;
    display: flex;
    justify-content: flex-end;
    gap: 8px;
}

@media (max-width: 1200px) {
    .conciliacao-cards-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .conciliacao-filters-top-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .conciliacao-filters-actions {
        grid-column: 1 / -1;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .conciliacao-filters-extra-row {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .conciliacao-main-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .conciliacao-cards-grid {
        grid-template-columns: 1fr;
    }

    .conciliacao-filters-top-row,
    .conciliacao-filters-extra-row,
    .conciliacao-suggestion-grid {
        grid-template-columns: 1fr;
    }

    .conciliacao-selected-grid {
        grid-template-columns: 1fr;
    }

    .conciliacao-filters-actions,
    .conciliacao-suggestion-actions {
        justify-content: stretch;
        flex-wrap: wrap;
    }

    .conciliacao-filters-actions .toolbar-btn,
    .conciliacao-suggestion-actions .toolbar-btn {
        flex: 1 1 auto;
    }

    .conciliacao-suggestion-drawer {
        width: 100vw;
    }
}

.fluxo-caixa-page .fluxo-cards-grid {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.fluxo-caixa-page .relatorio-filters-top-row {
    display: grid;
    grid-template-columns: minmax(0, 165px) minmax(0, 165px) minmax(0, 1fr);
    gap: 10px;
    align-items: end;
}

.fluxo-caixa-page .relatorio-filters-row {
    display: grid;
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    gap: 8px;
    align-items: end;
}

.fluxo-caixa-page .relatorio-filters-row label {
    min-width: 0;
}

.fluxo-caixa-page .relatorio-filters-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 8px;
    flex-wrap: wrap;
}

.fluxo-caixa-page .relatorio-filters-actions .toolbar-btn {
    height: 36px;
    padding: 0 12px;
    white-space: nowrap;
}

.fluxo-caixa-page .relatorio-filters-row .input {
    height: 36px;
}

.fluxo-caixa-page #fluxo-extra-filters[hidden] {
    display: none;
}

.fluxo-caixa-page .relatorio-table-panel table {
    min-width: 1280px;
}

.fluxo-caixa-page .fluxo-chart-panel {
    margin-bottom: 0;
    padding: 10px 12px;
}

.fluxo-caixa-page .fluxo-chart-wrap {
    height: 240px;
}

.fluxo-caixa-page .relatorio-footer-meta .empresas-summary-meta {
    white-space: normal;
    overflow-wrap: anywhere;
}

.relatorio-table-panel {
    padding-top: 8px;
}

.relatorio-table-panel table {
    min-width: 1220px;
}

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

.report-status {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 76px;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 0.75rem;
    font-weight: 650;
    letter-spacing: 0.01em;
}

.report-status-neutral {
    color: #5f6d7a;
    background: #eef2f6;
}

.report-status-paid {
    color: #00aad1;
    background: #e0ecff;
}

.report-status-overdue {
    color: #c44545;
    background: #fdeaea;
}

.relatorio-footer-meta {
    margin-top: 2px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.relatorio-footer-meta .empresas-summary-meta {
    margin: 0;
}

.relatorio-pagination {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.relatorio-pagination .toolbar-btn {
    height: 34px;
    min-width: 96px;
}

.relatorio-pagination-label {
    font-size: 0.82rem;
    color: #7c8894;
    font-weight: 550;
}

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

    .relatorio-pagar-page .relatorio-filters-top-row {
        grid-template-columns: 1fr;
    }

    .relatorio-pagar-page .relatorio-filters-actions {
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .relatorio-pagar-page .relatorio-filters-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fluxo-caixa-page .fluxo-cards-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fluxo-caixa-page .relatorio-filters-top-row {
        grid-template-columns: 1fr;
    }

    .fluxo-caixa-page .relatorio-filters-row {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .fluxo-caixa-page .relatorio-filters-actions {
        justify-content: flex-start;
        grid-column: 1 / -1;
        flex-wrap: wrap;
    }
}

@media (max-width: 900px) {
    .relatorio-cards-grid {
        grid-template-columns: 1fr;
    }

    .relatorio-pagar-page .relatorio-filters-row {
        grid-template-columns: 1fr;
    }

    .relatorio-pagar-page .relatorio-filters-actions {
        justify-content: stretch;
    }

    .relatorio-pagar-page .relatorio-filters-actions .toolbar-btn {
        flex: 1 1 auto;
    }

    .relatorio-pagination {
        width: 100%;
        justify-content: space-between;
    }

    .fluxo-caixa-page .fluxo-cards-grid {
        grid-template-columns: 1fr;
    }

    .fluxo-caixa-page .relatorio-filters-top-row {
        grid-template-columns: 1fr;
    }

    .fluxo-caixa-page .relatorio-filters-row {
        grid-template-columns: 1fr;
    }

    .fluxo-caixa-page .relatorio-filters-actions {
        justify-content: stretch;
    }

    .fluxo-caixa-page .relatorio-filters-actions .toolbar-btn {
        flex: 1 1 auto;
    }
}

/* Mobile usability overrides (MVP) */
@media (max-width: 900px) {
    .page-content {
        padding: 14px;
    }

    .panel {
        padding: 12px;
    }

    .table-panel,
    .relatorio-table-panel,
    .dash-preportal-table-wrap,
    .conciliacao-table-wrap {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .empresas-panel table {
        min-width: 760px;
    }

    .relatorio-table-panel table {
        min-width: 1040px;
    }

    .dash-mini-table {
        min-width: 680px;
    }

    .dash-hero-grid,
    .dashboard-row,
    .dash-mid-grid {
        grid-template-columns: 1fr;
    }

    .dash-preportal-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .dash-preportal-actions {
        width: 100%;
        grid-template-columns: 1fr;
        align-items: stretch;
        gap: 8px;
    }

    .dash-inline-link {
        font-size: 0.86rem;
        padding: 4px 0;
    }

    .dash-period-tabs {
        width: 100%;
    }

    .dash-tab-btn {
        min-height: 40px;
    }

    .dash-preportal-panel,
    .dash-side-summary {
        min-height: 0;
        max-height: none;
        height: auto;
    }

    .dash-next-name {
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .contas-pagar-page .contas-filters-row,
    .relatorio-pagar-page .relatorio-filters-top-row,
    .relatorio-pagar-page .relatorio-filters-row,
    .fluxo-caixa-page .relatorio-filters-top-row,
    .fluxo-caixa-page .relatorio-filters-row {
        grid-template-columns: 1fr !important;
    }

    .contas-filters-actions,
    .relatorio-filters-actions,
    .fluxo-caixa-page .relatorio-filters-actions,
    .empresas-toolbar-actions {
        width: 100%;
        justify-content: stretch !important;
        flex-wrap: wrap;
        gap: 8px;
    }

    .contas-filters-actions .toolbar-btn,
    .relatorio-filters-actions .toolbar-btn,
    .fluxo-caixa-page .relatorio-filters-actions .toolbar-btn,
    .empresas-toolbar-actions .toolbar-btn {
        flex: 1 1 100%;
        width: 100%;
    }

    .contas-drawer .empresas-drawer-actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 8px;
        align-items: stretch;
    }

    .contas-drawer .empresas-drawer-actions .btn {
        width: 100%;
        min-width: 0;
        margin: 0;
        justify-content: center;
        padding: 0 10px;
        min-height: 42px;
        font-size: 0.9rem;
        line-height: 1.15;
        white-space: nowrap;
    }

    .contas-drawer .empresas-drawer-actions .btn-conta-new {
        display: none !important;
    }

    .drawer-panel,
    .drawer--contas-pagar,
    .dash-drawer-shell,
    .conciliacao-suggestion-drawer,
    .conciliacao-import-drawer {
        width: 100vw !important;
        min-width: 0 !important;
        max-width: 100vw !important;
    }

    .drawer-panel {
        padding: 12px 12px 16px;
    }

    .empresas-drawer-header {
        padding: 12px 12px 8px;
    }

    .empresas-drawer-body {
        padding: 0 12px 14px;
    }

    .contas-drawer .conta-file-picker {
        flex-wrap: wrap;
        align-items: flex-start;
        gap: 8px;
    }

    .contas-drawer .conta-file-picker-name {
        width: 100%;
        white-space: normal;
        word-break: break-word;
    }
}

@media (max-width: 768px) {
    .topbar {
        padding: 8px 12px;
        min-height: 56px;
    }

    .topbar-page-title {
        max-width: calc(100vw - 146px);
    }

    .topbar-page-text {
        font-size: 1rem;
    }

    .profile-name {
        display: none;
    }

    .profile-trigger {
        padding: 4px;
        gap: 4px;
    }

    .profile-caret {
        font-size: 0.68rem;
    }

    .input,
    .btn,
    .toolbar-btn,
    .menu-toggle {
        min-height: 44px;
    }

    .btn,
    .toolbar-btn {
        font-size: 0.95rem;
    }

    .dash-hero-card {
        grid-template-columns: 44px 1fr;
        padding: 12px;
        min-height: 84px;
    }

    .dash-hero-icon {
        width: 44px;
        height: 44px;
        font-size: 1.1rem;
    }

    .dash-hero-copy h2 {
        font-size: 1.35rem;
    }

    .dash-hero-count {
        font-size: 0.84rem;
    }

    .dash-hero-meta {
        font-size: 0.76rem;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .dash-side-total strong {
        white-space: normal;
        word-break: break-word;
    }

    .dash-drawer-header {
        padding: 0 2px;
    }

    .dash-drawer-header h3 {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    .auth-wrap {
        padding: 14px;
    }

    .auth-panel {
        width: 100%;
        padding: 16px 14px;
        border-radius: 12px;
    }

    .auth-brand {
        margin-bottom: 14px;
    }

    .auth-brand-logo {
        width: min(88%, 260px);
    }

    .auth-actions {
        margin-top: 10px;
    }

    .auth-actions .btn {
        width: 100%;
    }

    .contas-mobile-filters-toggle {
        display: inline-flex !important;
        width: 100%;
    }

    #conciliacao-filters-body.mobile-hidden {
        display: none !important;
    }

    .conciliacao-page,
    .conciliacao-filters-panel,
    .conciliacao-filters-panel form,
    .conciliacao-main-grid,
    .conciliacao-left-panel,
    .conciliacao-import-history-panel,
    .conciliacao-table-wrap {
        min-width: 0;
        max-width: 100%;
    }

    .conciliacao-page {
        overflow-x: hidden;
    }

    .conciliacao-filters-top-row,
    .conciliacao-filters-extra-row,
    .conciliacao-suggestion-grid {
        grid-template-columns: 1fr !important;
    }

    .conciliacao-filters-actions,
    .conciliacao-suggestion-actions {
        width: 100%;
        justify-content: stretch !important;
        flex-wrap: wrap;
        gap: 8px;
    }

    .conciliacao-filters-actions .toolbar-btn,
    .conciliacao-suggestion-actions .toolbar-btn {
        flex: 1 1 100%;
        width: 100%;
        min-width: 0;
        white-space: normal;
    }

    .contas-filters-row.mobile-hidden {
        display: none !important;
    }

    .empresas-export,
    #relatorio-export-btn,
    #relatorio-receber-export-btn,
    #fluxo-export-btn {
        display: none !important;
    }

    .relatorio-pagar-page .relatorio-cards-grid,
    .fluxo-caixa-page .fluxo-cards-grid,
    .conciliacao-page .conciliacao-cards-grid {
        display: none !important;
    }
}

.contas-mobile-filters-toggle {
    display: none;
}

.pagadores-page .empresas-drawer #pagador-edit-cpf-cnpj-error:empty,
.pagadores-page .empresas-drawer #pagador-edit-telefone-error:empty {
    display: none;
}

.pagadores-page #pagador-edit-form > .form-grid + .form-grid {
    margin-top: 12px;
}

.settings-page {
    display: grid;
    gap: 16px;
    width: 100%;
    height: calc(100vh - 128px);
    overflow: hidden;
}

.settings-page-actions {
    display: flex;
    justify-content: flex-end;
    align-items: center;
}

.settings-hero,
.settings-history-card {
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    min-height: 0;
    padding: 18px;
}

.settings-hero {
    display: grid;
    gap: 0;
}

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

.settings-summary {
    display: grid;
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 14px;
    align-items: center;
    padding: 0;
    border: 0;
    background: transparent;
}

.settings-summary--compact {
    min-width: 0;
}

.settings-summary-avatar {
    width: 56px;
    height: 56px;
}

.settings-summary-avatar .profile-avatar {
    width: 56px;
    height: 56px;
}

.settings-summary-avatar .profile-avatar-fallback {
    font-size: 1.15rem;
}

.settings-summary-details {
    min-width: 0;
}

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

.settings-summary-grid--plain {
    align-items: stretch;
}

.settings-summary-row {
    display: grid;
    gap: 4px;
    min-width: 0;
    padding: 6px 0;
    border-bottom: 1px solid #edf1f5;
}

.settings-summary-row:last-child {
    border-bottom: 0;
}

.settings-summary-row--plain {
    border-radius: 0;
}

.settings-summary-row--card {
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--bg);
    border-bottom: 0;
}

.settings-summary-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.settings-summary-value {
    font-size: 0.98rem;
    font-weight: 650;
    color: #1b2733;
    overflow-wrap: anywhere;
}

.settings-section-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.settings-section-header--compact {
    margin-bottom: 12px;
}

.settings-history-count {
    color: #64748b;
    font-size: 0.86rem;
    font-weight: 600;
    text-align: right;
}

.settings-history-table-wrap {
    overflow: auto;
    min-height: 0;
    max-height: calc(100vh - 330px);
    scrollbar-width: thin;
}

.settings-history-table {
    width: 100%;
    border-collapse: collapse;
}

.settings-history-table th,
.settings-history-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #edf1f5;
    text-align: left;
    white-space: nowrap;
    font-size: 0.84rem;
    line-height: 1.35;
}

.settings-history-table th {
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
    font-weight: 700;
}

.settings-history-table td {
    color: #273444;
}

.settings-history-table td:nth-child(2),
.settings-history-table td:nth-child(3) {
    font-size: 0.84rem;
}

.settings-history-table td:last-child {
    white-space: normal;
}

.settings-history-footer {
    display: flex;
    justify-content: flex-end;
    padding-top: 10px;
}

.settings-history-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 9px;
    font-size: 0.74rem;
    font-weight: 700;
    border-radius: 999px;
}

.settings-history-badge--success {
    background: rgba(0, 170, 209, 0.1);
    color: #0096bb;
}

.settings-history-badge--error {
    background: rgba(207, 77, 77, 0.12);
    color: #b64949;
}

.settings-history-empty {
    padding: 28px 18px;
    text-align: center;
    color: #64748b;
    font-size: 0.9rem;
}

.settings-history-empty strong {
    display: block;
    margin-bottom: 6px;
    color: #1b2733;
}

.settings-drawer-backdrop {
    z-index: 1150;
}

.settings-drawer-panel {
    width: min(100vw, clamp(700px, 60vw, 980px));
    z-index: 1160;
}

.settings-drawer-head {
    display: grid;
    gap: 4px;
}

.settings-drawer-body {
    display: grid;
    gap: 14px;
}

.settings-drawer-kicker {
    margin: 0;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #00aad1;
}

.settings-drawer-title {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 800;
    color: #0f172a;
}

.settings-drawer-subtitle {
    margin: 0;
    color: #64748b;
    font-size: 0.93rem;
    line-height: 1.45;
}

.settings-drawer-tabs {
    display: flex;
    gap: 8px;
    margin: 14px 0 18px;
    padding: 4px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: #f6f9fc;
}

.settings-drawer-tab {
    flex: 1;
    border: 0;
    background: transparent;
    color: #607080;
    font-size: 0.92rem;
    font-weight: 700;
    padding: 10px 14px;
    border-radius: 10px;
    cursor: pointer;
    transition: background-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease;
}

.settings-drawer-tab.active {
    background: #fff;
    color: #0096bb;
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.06);
}

.settings-tab-panel {
    display: none;
}

.settings-tab-panel.active {
    display: grid;
    gap: 14px;
}

.settings-block {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 14px;
    background: #fff;
    display: grid;
    gap: 14px;
}

.settings-block__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.settings-block__title {
    margin: 0;
    font-size: 1rem;
    font-weight: 750;
}

.settings-block__text {
    margin: 4px 0 0;
    color: #64748b;
    font-size: 0.92rem;
    line-height: 1.45;
}

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

.settings-form-field {
    display: grid;
    gap: 6px;
    min-width: 0;
}

.settings-form-field--full {
    grid-column: 1 / -1;
}

.settings-form-field label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: #64748b;
}

.settings-form-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

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

.settings-drawer-actions {
    margin-top: 14px;
    justify-content: flex-end;
}

.settings-drawer-history-wrap {
    max-height: 42vh;
}

.settings-drawer-history-table th,
.settings-drawer-history-table td {
    white-space: nowrap;
}

.settings-drawer-history-table td:last-child {
    white-space: normal;
}

.settings-drawer-open {
    overflow: hidden;
}

@media (max-width: 900px) {
    .settings-page {
        height: auto;
        overflow: visible;
    }

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

    .settings-summary-grid,
    .settings-form-grid,
    .settings-password-grid {
        grid-template-columns: 1fr;
    }

    .settings-drawer-panel {
        width: 100vw;
    }

    .settings-history-table-wrap {
        max-height: none;
    }
}
