@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&family=Plus+Jakarta+Sans:ital,wght@0,400;0,500;0,600;0,700;0,800&display=swap');

/* Tokens globais: moradiq-tokens.css (carregado antes deste arquivo no HTML) */

[data-theme="dark"] .modal {
    background: rgba(2, 6, 23, 0.62);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    background-color: var(--background);
    color: var(--text);
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    font-weight: 400;
    line-height: 1.5;
    letter-spacing: -0.011em;
    overflow: hidden;
    height: 100vh;
    transition: background-color var(--transition-base), color var(--transition-base);
}

.app-container {
    display: flex;
    height: 100vh;
    width: 100vw;
    background-color: var(--background);
}

/* ===== SIDEBAR ===== */
.sidebar {
    width: 272px;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: var(--space-lg) var(--space-md);
    flex-shrink: 0;
    box-shadow: var(--shadow-xs);
    overflow-y: auto;
    transition: background-color var(--transition-base), border-color var(--transition-base);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-lg);
    padding: var(--space-xs) var(--space-xs) var(--space-md);
    border-bottom: 1px solid var(--border);
}

.sidebar-logo img {
    width: 100%;
    max-height: 84px;
    object-fit: contain;
    transition: opacity var(--transition-base);
}

.sidebar-logo img:hover {
    opacity: 0.92;
}

.nav-links {
    list-style: none;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.nav-item {
    margin-bottom: 0;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 0.625rem 0.875rem;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    transition: background-color var(--transition-base), color var(--transition-base), border-color var(--transition-base), box-shadow var(--transition-base);
    cursor: pointer;
    font-weight: 500;
    font-size: var(--text-sm);
    position: relative;
    border-left: 3px solid transparent;
}

.nav-link:hover {
    background-color: color-mix(in srgb, var(--primary-lighter) 88%, var(--surface));
    color: var(--primary);
    border-left-color: transparent;
}

.nav-link.active {
    background: color-mix(in srgb, var(--primary-lighter) 70%, var(--surface));
    color: var(--primary);
    font-weight: 600;
    border-left-color: var(--primary);
    box-shadow: none;
}

.nav-link i {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
}

/* Sidebar Footer & Sync Info */
.sidebar-footer {
    margin-top: auto;
    padding: 1rem 0;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

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

.user-details {
    flex-grow: 1;
    min-width: 0;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.2;
}

.user-role {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

.sidebar-sync-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--surface-alt);
    border-radius: var(--radius-md);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.sync-info {
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-sync-small {
    background: transparent;
    border: none;
    color: var(--primary);
    padding: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
}

.btn-sync-small:hover {
    background: var(--primary-lighter);
    color: var(--primary-dark);
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}

.spinning {
    animation: spin 1s linear infinite;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--text-sm);
    color: var(--text-on-primary);
    flex-shrink: 0;
    box-shadow: var(--shadow-primary);
}

/* ===== MAIN CONTENT ===== */
.main-content {
    flex: 1 1 0%;
    min-height: 0;
    min-width: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: var(--space-xl) var(--space-2xl) var(--space-2xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
    background-color: var(--background);
}

/* ===== HEADER & TITLE ===== */
.header-context {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-2xl);
}

.page-title h1 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    font-weight: 600;
    color: var(--text);
    margin-bottom: var(--space-xs);
    letter-spacing: -0.022em;
    line-height: 1.25;
}

.page-title p {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 400;
}

.filters-group {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    align-items: center;
}

/* ===== CLIENTES HEADER ===== */
.clientes-toolbar {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.clientes-search-filter {
    width: 240px;
    flex: 0 0 240px;
}

.clientes-search-input-wrap {
    border: none;
    padding: 0 1rem;
    width: 100%;
}

.dashboard-filters {
    background: var(--surface);
    padding: 0.375rem 0.5rem;
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border);
    display: flex;
    gap: 0;
    transition: all var(--transition-base);
}

.dashboard-filters:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.select-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    padding: 0 var(--space-lg);
    border-right: 1px solid var(--border);
    color: var(--text-secondary);
}

.select-wrapper:last-child {
    border-right: none;
}

.select-wrapper i {
    color: var(--primary);
    transition: color var(--transition-base);
}

.select-wrapper:hover i {
    color: var(--primary-hover);
}

.select-wrapper select {
    border: none;
    background: transparent;
    padding: var(--space-xs) 0;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    text-transform: capitalize;
    outline: none;
    appearance: none;
}

.select-wrapper select:hover {
    color: var(--primary);
}

/* ===== FORM ELEMENTS ===== */
input,
select,
textarea {
    padding: 0.75rem 1rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    outline: none;
    background: var(--surface);
    font-size: var(--text-sm);
    font-family: 'Inter', sans-serif;
    color: var(--text);
    transition: all var(--transition-base);
    color-scheme: light;
}

[data-theme="dark"] input,
[data-theme="dark"] select,
[data-theme="dark"] textarea {
    color-scheme: dark;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(249, 115, 22, 0.12);
    background: var(--surface);
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted);
}

input:disabled,
select:disabled,
textarea:disabled {
    background-color: var(--surface-alt);
    color: var(--text-muted);
    cursor: not-allowed;
    opacity: 0.6;
}

/* Custom Date Picker Indicator to match the theme */
input[type="date"],
input[type="month"] {
    position: relative;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator,
input[type="month"]::-webkit-calendar-picker-indicator {
    background-color: var(--primary-lighter);
    padding: 6px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    color: var(--primary);
    /* Invert colors slightly to make it orange based on system preferences */
    filter: invert(0.5) sepia(1) saturate(5) hue-rotate(350deg);
}

[data-theme="dark"] input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="month"]::-webkit-calendar-picker-indicator {
    filter: invert(0.8) sepia(1) saturate(5) hue-rotate(350deg);
    background-color: var(--primary-light);
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text);
    font-size: var(--text-sm);
}

/* ===== KPI GRID ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: var(--space-xl);
}

.kpi-card {
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-alt) 100%);
    padding: var(--space-2xl);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    position: relative;
    overflow: hidden;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
    opacity: 0.92;
}

.kpi-card:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
    border-color: color-mix(in srgb, var(--border) 65%, var(--primary-light));
}

.kpi-card.clickable {
    cursor: pointer;
}

.kpi-card.clickable:hover {
    background: color-mix(in srgb, var(--surface) 92%, var(--primary-lighter));
}

.kpi-card.clickable:active {
    transform: translateY(0);
    box-shadow: var(--shadow-sm);
}

.kpi-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: var(--space-lg);
}

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    box-shadow: var(--shadow-primary);
    flex-shrink: 0;
}

.kpi-value {
    font-size: var(--text-3xl);
    font-weight: 600;
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text);
    line-height: 1;
    margin-bottom: var(--space-xs);
    letter-spacing: -0.02em;
}

.kpi-label {
    color: var(--text-secondary);
    font-size: var(--text-sm);
    font-weight: 500;
}

.kpi-footer {
    color: var(--success);
    font-size: var(--text-xs);
    font-weight: 600;
    margin-top: var(--space-sm);
    display: flex;
    align-items: center;
    gap: var(--space-xs);
}

/* ===== TABLES ===== */
.table-container {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    overflow-x: auto;
    overflow-y: hidden;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    flex-shrink: 0;
}

.table-container:hover {
    box-shadow: var(--shadow-sm);
    border-color: color-mix(in srgb, var(--border) 70%, var(--primary-light));
}

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

th {
    background: var(--surface-alt);
    text-align: left;
    padding: 0.875rem var(--space-md);
    font-size: 0.6875rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-tertiary);
    border-bottom: 1px solid var(--border);
    letter-spacing: 0.06em;
}

td {
    padding: 0.875rem var(--space-md);
    border-bottom: 1px solid var(--divider);
    font-size: var(--text-sm);
    color: var(--text);
    font-weight: 400;
}

tr {
    transition: all var(--transition-fast);
}

tr:hover td {
    background-color: color-mix(in srgb, var(--primary-lighter) 35%, var(--surface));
}

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

/* ===== REAJUSTES VIEW ===== */
.reajustes-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.reajustes-kpi .kpi-value {
    margin-top: 0.2rem;
}

.reajustes-kpi-today {
    border-color: rgba(180, 83, 9, 0.2);
}

.reajustes-kpi-today::before {
    background: linear-gradient(90deg, #b45309, #f59e0b);
}

.reajustes-kpi-today .kpi-value {
    color: #b45309;
}

.reajustes-kpi-overdue {
    border-color: rgba(239, 68, 68, 0.25);
}

.reajustes-kpi-overdue::before {
    background: linear-gradient(90deg, #ef4444, #f87171);
}

.reajustes-kpi-overdue .kpi-value {
    color: #dc2626;
}

.reajustes-kpi-upcoming {
    border-color: rgba(14, 165, 233, 0.25);
}

.reajustes-kpi-upcoming::before {
    background: linear-gradient(90deg, #0ea5e9, #38bdf8);
}

.reajustes-kpi-upcoming .kpi-value {
    color: #0284c7;
}

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

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

.reajustes-table td {
    vertical-align: middle;
}

.reajustes-contract-id {
    font-weight: 700;
    color: var(--text);
}

.reajustes-indice {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
    color: #3730a3;
    background: #eef2ff;
    border: 1px solid #c7d2fe;
}

.reajustes-rent {
    font-weight: 700;
    color: var(--text);
}

.reajuste-status-chip {
    display: inline-flex;
    align-items: center;
    padding: 0.25rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    border: 1px solid transparent;
}

.reajuste-status-chip.is-overdue {
    color: #b91c1c;
    background: #fee2e2;
    border-color: #fca5a5;
}

.reajuste-status-chip.is-today {
    color: #b45309;
    background: #ffedd5;
    border-color: #fdba74;
}

.reajuste-status-chip.is-upcoming {
    color: #0369a1;
    background: #e0f2fe;
    border-color: #7dd3fc;
}

.reajustes-actions-col {
    text-align: right;
}

.reajustes-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    background: #6366f1;
    border-color: #6366f1;
}

.reajustes-btn:hover {
    background: #4f46e5;
    border-color: #4f46e5;
}

.reajustes-empty-row {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem 1rem;
}

/* ===== STATUS BADGES ===== */
.status-badge {
    padding: 0.5rem 1rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 600;
    display: inline-block;
    text-transform: capitalize;
    transition: all var(--transition-fast);
    border: 1px solid transparent;
}

.status-badge:hover {
    transform: none;
    box-shadow: none;
    filter: brightness(0.98);
}

.status-pago {
    background: var(--success-light);
    color: #065F46;
    border-color: #6EE7B7;
}

.status-carência {
    background: #fdf2f8;
    color: #db2777;
    border-color: #fbcfe8;
}

.status-atrasado {
    background: var(--error-light);
    color: #7F1D1D;
    border-color: #FCA5A5;
}

.status-em_aberto {
    background: var(--warning-light);
    color: #78350F;
    border-color: #FDE68A;
}

.status-ativo {
    background: var(--info-light);
    color: #0369A1;
    border-color: #A5F3FC;
}

.status-inativo {
    background: #E5E7EB;
    color: #4B5563;
}

.status-carência {
    background: #DBEAFE;
    color: #1E40AF;
    border-color: #BFDBFE;
}

/* ===== BUTTONS ===== */
.btn {
    padding: 0.875rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-size: var(--text-sm);
    font-family: 'Inter', sans-serif;
    outline: none;
    position: relative;
    overflow: hidden;
}

.btn:active {
    transform: scale(0.98);
}

.btn:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 94%, white) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: var(--shadow-sm), var(--shadow-primary);
    font-weight: 600;
}

.btn-primary:hover {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: var(--shadow-md), 0 4px 24px rgba(249, 115, 22, 0.18);
    transform: translateY(-1px);
}

.btn-primary:disabled,
.btn-primary:disabled:hover {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    box-shadow: var(--shadow-primary);
}

.btn-secondary {
    background: var(--surface-alt);
    border: 1.5px solid var(--border);
    color: var(--text);
    font-weight: 600;
}

.btn-secondary:hover {
    background: var(--surface);
    border-color: color-mix(in srgb, var(--primary) 38%, var(--border));
    color: var(--primary-dark);
    transform: none;
    box-shadow: var(--shadow-xs);
}

.btn-secondary:disabled,
.btn-secondary:disabled:hover {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
    background: var(--surface-alt);
    border-color: var(--border);
    color: var(--text);
    box-shadow: none;
}

.btn-ghost {
    background: transparent;
    border: none;
    color: var(--primary);
    font-weight: 600;
}

.btn-ghost:hover {
    background: color-mix(in srgb, var(--primary-lighter) 85%, var(--surface));
    color: var(--primary-dark);
    transform: none;
}

.btn-expand {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    transition: transform var(--transition-base), color var(--transition-base);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-xs);
    border-radius: var(--radius-md);
    width: 32px;
    height: 32px;
}

.btn-expand:hover {
    background: var(--primary-lighter);
    color: var(--primary);
}

.btn-expand.active {
    transform: rotate(90deg);
    color: var(--primary);
}

/* Button with disabled state styling */
.btn-disabled,
button:disabled {
    opacity: 0.5 !important;
    cursor: not-allowed !important;
}

/* Link buttons (styled as buttons) */
a.btn {
    text-decoration: none;
}

a.btn:hover {
    text-decoration: none;
}

a.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: var(--shadow-primary);
}

a.btn-primary:hover {
    background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
    box-shadow: var(--shadow-md), 0 4px 24px rgba(249, 115, 22, 0.18);
    transform: translateY(-1px);
    color: white;
}

a.btn-secondary {
    background: var(--surface-alt);
    border: 1.5px solid var(--border);
    color: var(--text);
}

a.btn-secondary:hover {
    background: var(--surface);
    border-color: var(--primary);
    color: var(--primary);
}

/* Button variants for different contexts */
.btn.sm {
    padding: 0.5rem 0.75rem;
    font-size: var(--text-xs);
}

.btn.lg {
    padding: 1rem 2rem;
    font-size: var(--text-base);
}

/* Buttons with icons only */
.btn-icon {
    padding: var(--space-sm);
    width: 32px;
    height: 32px;
    min-width: 32px;
}

.btn-icon i {
    width: 18px;
    height: 18px;
}

/* Fullwidth button */
.btn-block {
    width: 100%;
}

/* ===== INLINE BUTTON STYLES OVERRIDES ===== */
/* These ensure all inline-styled buttons are still properly styled */

button[type="button"],
button[type="submit"],
button[type="reset"],
a[role="button"] {
    transition: all var(--transition-base);
}

/* Override inline styles for consistency */
button[style*="background: #"],
button[style*="background:#"] {
    transition: all var(--transition-base) !important;
}

button[style*="color: white"]:hover,
button[style*="color: white"]:active {
    transform: translateY(-1px);
    filter: brightness(0.95);
}

/* Small buttons (commonly used in tables) */
button[style*="font-size: 0.7rem"],
button[style*="font-size: 0.75rem"],
button[style*="padding: 0.3rem"],
button[style*="padding: 0.4rem"] {
    transition: all var(--transition-fast);
    border-radius: var(--radius-md);
}

button[style*="font-size: 0.7rem"]:hover,
button[style*="font-size: 0.75rem"]:hover,
button[style*="padding: 0.3rem"]:hover,
button[style*="padding: 0.4rem"]:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

/* Links styled as buttons */
a[style*="display: flex"][style*="background"] {
    transition: all var(--transition-base);
    border-radius: var(--radius-md);
}

a[style*="display: flex"][style*="background"]:hover {
    transform: translateY(-1px);
    opacity: 0.95;
}

/* Buttons in modals and forms */
.modal-footer button,
.form-actions button {
    transition: all var(--transition-base);
}

.modal-footer button:not(:disabled):hover,
.form-actions button:not(:disabled):hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

/* Special button colors that should get laranja treatment */
button[style*="background: #f97316"],
button[style*="background: #059669"],
button[style*="background: #334155"],
button[style*="background: #dc2626"] {
    transition: all var(--transition-base);
    border-radius: var(--radius-md);
}

button[style*="background: #f97316"]:hover {
    background: var(--primary) !important;
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

button[style*="background: #059669"]:hover {
    background: var(--success) !important;
    transform: translateY(-2px);
}

button[style*="background: #334155"]:hover {
    background: var(--secondary-light) !important;
    transform: translateY(-2px);
}

button[style*="background: #dc2626"]:hover {
    background: var(--error) !important;
    transform: translateY(-2px);
}

/* Print button enhancement */
button[style*="no-print"],
.no-print button {
    border-radius: var(--radius-md);
    transition: all var(--transition-base);
    font-weight: 600;
}

.no-print:hover button,
button[style*="no-print"]:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
}

/* Download and Import buttons */
button[style*="padding: 12px 24px"] {
    border-radius: var(--radius-lg);
    transition: all var(--transition-base);
    font-weight: 700;
}

button[style*="padding: 12px 24px"]:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-lg);
    filter: brightness(0.95);
}

/* ===== CARDS ===== */
.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl) var(--space-2xl);
    box-shadow: var(--shadow-xs);
    transition: box-shadow var(--transition-base), border-color var(--transition-base);
}

.card:hover {
    box-shadow: var(--shadow-sm);
    border-color: color-mix(in srgb, var(--border) 75%, var(--primary-light));
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), var(--primary-hover));
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    opacity: 0.85;
}

.card-title {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: var(--text-lg);
    font-weight: 600;
    margin-bottom: var(--space-md);
    color: var(--text);
    letter-spacing: -0.018em;
}

.card-subtitle {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    font-weight: 500;
}

/* ===== SHORTCUTS ===== */
.shortcuts-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: var(--space-xl);
}

.shortcut-btn {
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-alt) 100%);
    padding: var(--space-2xl) var(--space-lg);
    border-radius: var(--radius-lg);
    border: 1.5px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-lg);
    text-decoration: none;
    color: var(--text);
    transition: all var(--transition-base);
    cursor: pointer;
    font-weight: 600;
    position: relative;
    overflow: hidden;
}

.shortcut-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
    opacity: 0;
    transition: opacity var(--transition-base);
}

.shortcut-btn:hover {
    border-color: color-mix(in srgb, var(--border) 55%, var(--primary));
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.shortcut-btn:hover::before {
    opacity: 1;
}

.shortcut-icon {
    width: 56px;
    height: 56px;
    background: var(--primary-lighter);
    color: var(--primary);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all var(--transition-base);
}

.shortcut-btn:hover .shortcut-icon {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: white;
    transform: scale(1.04);
    box-shadow: var(--shadow-primary);
}

.shortcut-label {
    font-weight: 600;
    font-size: var(--text-sm);
    text-align: center;
    color: var(--text);
}

/* ===== MODALS ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.38);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: var(--z-modal-backdrop);
    padding: var(--space-lg);
    animation: fadeIn var(--transition-base) ease-out;
}

.modal.active {
    display: flex;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-content {
    background: var(--surface);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 600px;
    padding: var(--space-xl) var(--space-2xl);
    box-shadow: var(--shadow-xl);
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp var(--transition-slow) cubic-bezier(0.2, 0, 0, 1) forwards;
    border: 1px solid var(--border);
    border-top: 3px solid var(--primary);
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.99);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.modal-header h2 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.modal-close {
    background: none;
    border: none;
    font-size: var(--text-xl);
    cursor: pointer;
    color: var(--text-secondary);
    transition: background-color var(--transition-fast), color var(--transition-fast);
    width: 36px;
    height: 36px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-full);
}

.modal-close:hover {
    color: var(--primary);
    transform: none;
    background: var(--surface-alt);
    border-radius: var(--radius-full);
}

/* ===== FORMS ===== */
.form-container {
    background: var(--surface);
    padding: var(--space-xl) var(--space-2xl);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xs);
    margin-bottom: var(--space-2xl);
    animation: slideDown var(--transition-base) ease-out;
    border-top: 3px solid var(--primary);
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.form-header {
    margin-bottom: var(--space-lg);
    padding-bottom: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.form-header h2 {
    font-family: 'Inter', system-ui, sans-serif;
    font-size: var(--text-xl);
    font-weight: 600;
    color: var(--text);
    letter-spacing: -0.02em;
}

.form-section {
    margin-bottom: var(--space-2xl);
}

.form-section-title {
    font-size: var(--text-xs);
    font-weight: 800;
    text-transform: uppercase;
    color: var(--primary);
    letter-spacing: 0.05em;
    margin-bottom: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

.form-section-title::after {
    content: '';
    flex-grow: 1;
    height: 2px;
    background: linear-gradient(90deg, var(--primary), transparent);
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-lg);
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-md);
    margin-top: var(--space-xl);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border);
}

/* ===== ALERTS & NOTIFICATIONS ===== */
.alert {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    font-weight: 500;
    display: flex;
    gap: var(--space-md);
    align-items: flex-start;
    margin-bottom: var(--space-md);
    border-left: 4px solid;
    animation: slideDown var(--transition-base) ease-out;
}

.alert-success {
    background: var(--success-light);
    color: #065F46;
    border-left-color: var(--success);
}

.alert-error {
    background: var(--error-light);
    color: #7F1D1D;
    border-left-color: var(--error);
}

.alert-warning {
    background: var(--warning-light);
    color: #78350F;
    border-left-color: var(--warning);
}

.alert-info {
    background: var(--info-light);
    color: #0369A1;
    border-left-color: var(--info);
}

/* ===== TOASTS ===== */
.toast-container {
    position: fixed;
    top: var(--space-xl);
    right: var(--space-xl);
    z-index: var(--z-toast);
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
    max-width: 400px;
    pointer-events: none;
}

.toast {
    pointer-events: auto;
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: var(--space-md) var(--space-lg);
    box-shadow: var(--shadow-xl);
    border-left: 4px solid var(--primary);
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    animation: toastSlideIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    transform-origin: top right;
    max-width: 400px;
    min-width: 300px;
    transition: all var(--transition-base);
    position: relative;
}

.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary) 0%, var(--primary-hover) 100%);
}

.toast.success {
    border-left-color: var(--success);
}

.toast.success::before {
    background: linear-gradient(90deg, var(--success) 0%, #34D399 100%);
}

.toast.error {
    border-left-color: var(--error);
}

.toast.error::before {
    background: linear-gradient(90deg, var(--error) 0%, #F87171 100%);
}

.toast.warning {
    border-left-color: var(--warning);
}

.toast.warning::before {
    background: linear-gradient(90deg, var(--warning) 0%, #FBBF24 100%);
}

.toast.info {
    border-left-color: var(--info);
}

.toast.info::before {
    background: linear-gradient(90deg, var(--info) 0%, #06B6D4 100%);
}

@keyframes toastSlideIn {
    from {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }

    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes toastSlideOut {
    from {
        opacity: 1;
        transform: translateX(0) scale(1);
    }

    to {
        opacity: 0;
        transform: translateX(100%) scale(0.9);
    }
}

.toast.exiting {
    animation: toastSlideOut 0.3s ease-out forwards;
}

.toast-icon {
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    margin-top: 2px;
}

.toast.success .toast-icon {
    background: var(--success);
}

.toast.error .toast-icon {
    background: var(--error);
}

.toast.warning .toast-icon {
    background: var(--warning);
}

.toast.info .toast-icon {
    background: var(--info);
}

.toast.default .toast-icon {
    background: var(--primary);
}

.toast-content {
    flex: 1;
    min-width: 0;
}

.toast-title {
    font-weight: 600;
    font-size: var(--text-sm);
    color: var(--text);
    margin-bottom: var(--space-2xs);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.toast-message {
    font-size: var(--text-sm);
    color: var(--text-secondary);
    line-height: 1.4;
}

.toast-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: var(--space-2xs);
    border-radius: var(--radius-sm);
    transition: all var(--transition-fast);
    flex-shrink: 0;
    margin-left: var(--space-xs);
}

.toast-close:hover {
    background: var(--surface-alt);
    color: var(--primary);
}

/* ===== LOADING STATES ===== */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: var(--space-md);
    min-height: 200px;
}

.loading-spinner {
    width: 48px;
    height: 48px;
    border: 3px solid var(--primary-lighter);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-spinner.small {
    width: 24px;
    height: 24px;
    border-width: 2px;
}

.loading-spinner.large {
    width: 64px;
    height: 64px;
    border-width: 4px;
}

.loading-dots {
    display: flex;
    gap: var(--space-xs);
}

.loading-dot {
    width: 8px;
    height: 8px;
    border-radius: var(--radius-full);
    background-color: var(--primary);
    animation: pulse 1.5s ease-in-out infinite;
}

.loading-dot:nth-child(2) {
    animation-delay: 0.2s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0.4s;
}

.loading-text {
    font-size: var(--text-base);
    color: var(--text-secondary);
    font-weight: 500;
    margin-top: var(--space-md);
    text-align: center;
}

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

@keyframes pulse {

    0%,
    100% {
        opacity: 0.4;
        transform: scale(0.8);
    }

    50% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 10px;
    height: 10px;
}

::-webkit-scrollbar-track {
    background: var(--background);
}

::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--text-muted) 55%, var(--primary));
    border-radius: var(--radius-full);
    border: 3px solid var(--background);
}

::-webkit-scrollbar-thumb:hover {
    background: color-mix(in srgb, var(--primary) 65%, var(--text-muted));
}

* {
    scrollbar-color: color-mix(in srgb, var(--text-muted) 50%, var(--primary)) var(--background);
    scrollbar-width: thin;
}

/* ===== BADGES ===== */
.badge {
    display: inline-block;
    padding: 0.375rem 0.875rem;
    border-radius: var(--radius-full);
    font-size: var(--text-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: var(--primary-lighter);
    color: var(--primary);
}

.badge-secondary {
    background: var(--surface-alt);
    color: var(--text-secondary);
}

/* ===== DIVIDERS ===== */
.divider {
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
    margin: var(--space-xl) 0;
}

/* ===== ACCESSIBILITY ===== */
:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
a:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 2px;
}

::selection {
    background-color: var(--primary-lighter);
    color: var(--text);
}

::-moz-selection {
    background-color: var(--primary-lighter);
    color: var(--text);
}

/* ===== RESPONSIVE DESIGN ===== */
@media (max-width: 1200px) {
    .sidebar {
        width: 260px;
    }

    .main-content {
        padding: var(--space-xl);
    }

    .kpi-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: var(--space-lg);
    }
}

@media (max-width: 768px) {
    .app-container {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        padding: var(--space-md);
        max-height: 70px;
        flex-direction: row;
        align-items: center;
        overflow-x: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
    }

    .sidebar-logo {
        margin-bottom: 0;
        margin-right: var(--space-xl);
        border-bottom: none;
        border-right: 2px solid var(--primary-lighter);
        padding-right: var(--space-lg);
    }

    .sidebar-logo img {
        max-height: 50px;
    }

    .nav-links {
        flex-direction: row;
        gap: var(--space-lg);
    }

    .user-info {
        margin-top: 0;
        margin-left: auto;
        border-top: none;
        border-left: 2px solid var(--primary-lighter);
        border-radius: 0;
        padding-left: var(--space-lg);
    }

    .main-content {
        padding: var(--space-lg);
        gap: var(--space-lg);
    }

    .page-title h1 {
        font-size: var(--text-2xl);
    }

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

    .shortcuts-section {
        grid-template-columns: repeat(2, 1fr);
    }

    table {
        font-size: var(--text-xs);
    }

    td,
    th {
        padding: var(--space-md);
    }

    .header-context {
        flex-direction: column;
        gap: var(--space-lg);
    }

    .clientes-toolbar {
        width: 100%;
        justify-content: flex-start;
    }

    .clientes-search-filter {
        width: 100%;
        flex-basis: 100%;
    }
}

@media (max-width: 480px) {
    .sidebar {
        flex-direction: column;
        max-height: none;
        position: fixed;
        left: -100%;
        top: 0;
        height: 100vh;
        width: 250px;
        z-index: 999;
        transition: left var(--transition-smooth);
        border-bottom: none;
        border-right: 1px solid var(--border);
        padding: var(--space-lg);
    }

    .sidebar.active {
        left: 0;
    }

    .sidebar-logo {
        margin-bottom: var(--space-lg);
        border-right: none;
        border-bottom: 2px solid var(--primary-lighter);
        padding-right: 0;
        margin-right: 0;
    }

    .nav-links {
        flex-direction: column;
        gap: var(--space-xs);
    }

    .user-info {
        margin-top: var(--space-lg);
        border-left: none;
        border-top: 2px solid var(--primary-lighter);
        padding-left: var(--space-md);
    }

    .main-content {
        padding: var(--space-md);
    }

    .page-title h1 {
        font-size: var(--text-xl);
    }

    .kpi-grid {
        grid-template-columns: 1fr;
        gap: var(--space-md);
    }

    .shortcuts-section {
        grid-template-columns: 1fr;
    }

    .modal-content {
        width: 95%;
        padding: var(--space-lg);
    }

    .filters-group {
        flex-direction: column;
        width: 100%;
    }

    .toast-container {
        left: var(--space-md);
        right: var(--space-md);
        top: auto;
        bottom: var(--space-md);
    }

    .toast {
        min-width: auto;
        max-width: 100%;
    }
}

/* ===== LOGIN PAGE ===== */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--secondary) 0%, var(--secondary-dark) 100%);
    height: 100vh;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: var(--space-xl);
}

.login-card {
    background: var(--surface);
    padding: var(--space-2xl);
    border-radius: var(--radius-2xl);
    box-shadow: var(--shadow-2xl);
    border-top: 4px solid var(--primary);
    position: relative;
    overflow: hidden;
}

/* ===== MICRO-INTERACTIONS ===== */
@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

@media (prefers-contrast: high) {
    :root {
        --text: #000000;
        --border: #000000;
    }

    .btn {
        border: 2px solid currentColor;
    }
}

/* ===== PRINT STYLES ===== */
@media print {

    .sidebar,
    .btn,
    .filters-group,
    .modal,
    .no-print,
    .user-info {
        display: none !important;
    }

    .main-content {
        padding: 0 !important;
        background: white !important;
    }

    .table-container {
        box-shadow: none !important;
        border: 1px solid #ddd !important;
    }

    body {
        background: white !important;
    }
}

/* ===== UTILITY CLASSES ===== */
.text-center {
    text-align: center;
}

.mt-auto {
    margin-top: auto;
}

.mb-auto {
    margin-bottom: auto;
}

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

.gap-md {
    gap: var(--space-md);
}

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

/* ============================================================
   ENTERPRISE UPGRADE — Moradiq
   Dark sidebar, enhanced login, charts, reports, modals
   ============================================================ */

/* ----- DARK PROFESSIONAL SIDEBAR ----- */
.sidebar {
    background: linear-gradient(170deg, #111C2F 0%, #17253A 55%, #1D2F47 100%) !important;
    border-right: none !important;
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.2) !important;
}

[data-theme="dark"] .sidebar {
    background: linear-gradient(170deg, #0D1728 0%, #132238 55%, #18304D 100%) !important;
    box-shadow: 6px 0 24px rgba(0, 0, 0, 0.32) !important;
}

.sidebar-logo {
    border-bottom: 1px solid rgba(255, 255, 255, 0.07) !important;
    padding-bottom: 1.25rem !important;
    margin-bottom: 1.5rem !important;
}

.nav-links {
    gap: 2px !important;
}

.nav-link {
    color: rgba(203, 213, 225, 0.75) !important;
    border-left-color: transparent !important;
    font-size: 0.85rem !important;
}

.nav-link span {
    font-size: 0.85rem;
    letter-spacing: 0.01em;
}

.nav-link i {
    opacity: 0.8;
}

.nav-link:hover {
    background-color: rgba(249, 115, 22, 0.12) !important;
    color: #FB923C !important;
    border-left-color: rgba(249, 115, 22, 0.6) !important;
    transform: none !important;
}

.nav-link:hover i {
    opacity: 1;
    color: #FB923C;
}

.nav-link.active {
    background: linear-gradient(135deg, rgba(249, 115, 22, 0.2) 0%, rgba(249, 115, 22, 0.07) 100%) !important;
    color: #F97316 !important;
    border-left-color: #F97316 !important;
    box-shadow: none !important;
}

.nav-link.active i {
    opacity: 1;
    color: #F97316;
}

/* User info at bottom of dark sidebar */
.sidebar .user-info {
    background: rgba(255, 255, 255, 0.05) !important;
    border-radius: 10px !important;
    border: 1px solid rgba(255, 255, 255, 0.07) !important;
    color: rgba(203, 213, 225, 0.85) !important;
}

.sidebar .user-info * {
    color: rgba(203, 213, 225, 0.85) !important;
}

.sidebar .user-info a {
    color: rgba(203, 213, 225, 0.6) !important;
}

.sidebar .user-info a:hover {
    color: #F97316 !important;
}

/* Theme toggle button in sidebar */
#theme-toggle {
    color: rgba(203, 213, 225, 0.65) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.07) !important;
    margin-top: 0.5rem !important;
    padding-top: 1rem !important;
}

#theme-toggle:hover {
    background-color: rgba(249, 115, 22, 0.12) !important;
    color: #FB923C !important;
}

/* ----- ENHANCED LOGIN PAGE ----- */
.login-enterprise-wrapper {
    display: flex;
    width: 100%;
    height: 100vh;
    overflow: hidden;
}

.login-enterprise-left {
    flex: 1;
    background: linear-gradient(145deg, #0A1628 0%, #142240 40%, #1A3460 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem;
    color: white;
    position: relative;
    overflow: hidden;
}

.login-enterprise-left::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(249, 115, 22, 0.12) 0%, transparent 70%);
    top: -150px;
    right: -150px;
    border-radius: 50%;
    pointer-events: none;
}

.login-enterprise-left::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.08) 0%, transparent 70%);
    bottom: -80px;
    left: -80px;
    border-radius: 50%;
    pointer-events: none;
}

.login-enterprise-left .brand-logo {
    width: 100%;
    max-width: 180px;
    margin-bottom: 2.5rem;
    filter: brightness(1.1) drop-shadow(0 4px 20px rgba(249, 115, 22, 0.3));
}

.login-enterprise-left h1 {
    font-family: 'Poppins', sans-serif;
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 1rem;
    line-height: 1.2;
    background: linear-gradient(135deg, #ffffff 0%, #FB923C 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.login-enterprise-left p {
    font-size: 1.05rem;
    color: rgba(203, 213, 225, 0.75);
    max-width: 380px;
    line-height: 1.7;
    margin-bottom: 2.5rem;
}

.login-features-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 400px;
}

.login-features-list li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: rgba(203, 213, 225, 0.8);
}

.login-features-list li .feat-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(249, 115, 22, 0.2);
    border: 1px solid rgba(249, 115, 22, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: #FB923C;
}

.login-enterprise-right {
    width: 480px;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 3rem;
    background: var(--surface);
    overflow-y: auto;
}

.login-form-container {
    width: 100%;
    max-width: 380px;
}

.login-form-container .login-headline {
    font-family: 'Poppins', sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 0.5rem;
}

.login-form-container .login-subline {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 2.5rem;
}

.login-form-group {
    margin-bottom: 1.25rem;
}

.login-form-group label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.login-input-wrap {
    position: relative;
}

.login-input-wrap input {
    width: 100%;
    padding: 0.9rem 1rem 0.9rem 2.8rem;
    border-radius: 10px;
    border: 1.5px solid var(--border);
    font-size: 0.95rem;
    transition: all 0.2s;
}

.login-input-wrap input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(249, 115, 22, 0.12);
}

.login-input-wrap .input-icon {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    width: 18px;
    height: 18px;
}

.login-submit-btn {
    width: 100%;
    padding: 1rem;
    border-radius: 10px;
    border: none;
    background: linear-gradient(135deg, #F97316 0%, #EA580C 100%);
    color: white;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 4px 15px rgba(249, 115, 22, 0.35);
    margin-top: 2rem;
    font-family: 'Inter', sans-serif;
}

.login-submit-btn:hover {
    background: linear-gradient(135deg, #EA580C 0%, #C2410C 100%);
    box-shadow: 0 8px 25px rgba(249, 115, 22, 0.45);
    transform: translateY(-2px);
}

.login-submit-btn:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none;
}

.login-error-msg {
    background: #FEF2F2;
    border: 1px solid #FECACA;
    color: #991B1B;
    padding: 0.85rem 1rem;
    border-radius: 8px;
    font-size: 0.875rem;
    margin-top: 1rem;
    display: none;
    align-items: center;
    gap: 8px;
}

/* ----- ALUGUEL PAGO (controle mensal) ----- */
.aluguel-pago-overlay {
    position: fixed;
    inset: 0;
    z-index: 100000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    animation: fadeIn 0.2s ease;
    cursor: pointer;
}

.aluguel-pago-overlay.aluguel-pago-overlay--out {
    opacity: 0;
    transition: opacity 0.28s ease;
    pointer-events: none;
}

.aluguel-pago-popup {
    cursor: default;
    background: linear-gradient(160deg, #ecfdf5 0%, #d1fae5 55%, #a7f3d0 100%);
    border: 2px solid #34d399;
    border-radius: 22px;
    padding: 2rem 2.5rem 1.85rem;
    box-shadow:
        0 28px 56px rgba(5, 150, 105, 0.28),
        0 0 0 1px rgba(255, 255, 255, 0.55) inset;
    animation: aluguelPagoPop 0.42s cubic-bezier(0.34, 1.45, 0.64, 1);
}

.aluguel-pago-popup .aluguel-pago-icon-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 1rem;
}

.aluguel-pago-popup .aluguel-pago-check {
    width: 76px;
    height: 76px;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(5, 150, 105, 0.35));
}

.aluguel-pago-popup .aluguel-pago-check-ring {
    fill: #059669;
    transform-origin: 26px 26px;
    animation: aluguelPagoRing 0.5s cubic-bezier(0.34, 1.45, 0.64, 1) forwards;
}

.aluguel-pago-popup .aluguel-pago-check-mark {
    fill: none;
    stroke: #fff;
    stroke-width: 3.25;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 42;
    stroke-dashoffset: 42;
    animation: aluguelPagoDraw 0.38s ease 0.15s forwards;
}

.aluguel-pago-popup .aluguel-pago-title {
    margin: 0;
    font-family: 'Poppins', sans-serif;
    font-size: 1.42rem;
    font-weight: 700;
    color: #065f46;
    text-align: center;
    letter-spacing: -0.02em;
}

@keyframes aluguelPagoPop {
    from {
        opacity: 0;
        transform: scale(0.88);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

@keyframes aluguelPagoRing {
    from {
        transform: scale(0.6);
        opacity: 0.5;
    }
    to {
        transform: scale(1);
        opacity: 1;
    }
}

@keyframes aluguelPagoDraw {
    to {
        stroke-dashoffset: 0;
    }
}

/* ----- CUSTOM CONFIRM MODAL ----- */
.custom-confirm-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.65);
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    animation: fadeIn 0.15s ease;
}

.custom-confirm-box {
    background: var(--surface);
    border-radius: 18px;
    padding: 2rem;
    max-width: 420px;
    width: 90%;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
    border-top: 4px solid var(--primary);
    animation: slideUp 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.custom-confirm-box.danger-confirm {
    border-top-color: #EF4444;
}

.custom-confirm-header {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 1rem;
}

.custom-confirm-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    background: #FEF3C7;
    color: #D97706;
}

.custom-confirm-icon.danger {
    background: #FEF2F2;
    color: #DC2626;
}

.custom-confirm-title {
    font-family: 'Poppins', sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.custom-confirm-msg {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: 1.75rem;
}

.custom-confirm-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

.confirm-btn-cancel {
    padding: 0.7rem 1.4rem;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    background: var(--surface-alt);
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'Inter', sans-serif;
}

.confirm-btn-cancel:hover {
    border-color: var(--border-dark);
    color: var(--text);
}

.confirm-btn-ok {
    padding: 0.7rem 1.4rem;
    border-radius: 8px;
    border: none;
    background: linear-gradient(135deg, #EF4444, #DC2626);
    color: white;
    font-weight: 700;
    font-size: 0.875rem;
    cursor: pointer;
    transition: all 0.15s;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    font-family: 'Inter', sans-serif;
}

.confirm-btn-ok:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(239, 68, 68, 0.4);
}

.confirm-btn-ok.primary-confirm {
    background: linear-gradient(135deg, #F97316, #EA580C);
    box-shadow: 0 4px 12px rgba(249, 115, 22, 0.3);
}

.confirm-btn-ok.primary-confirm:hover {
    box-shadow: 0 6px 18px rgba(249, 115, 22, 0.4);
}

/* ----- REPORTS / ANALYTICS PAGE ----- */
.reports-chart-container {
    padding: 2rem;
}

.chart-bars-wrapper {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    height: 220px;
    border-bottom: 2px solid var(--border);
    border-left: 2px solid var(--border);
    padding: 0 0 0 8px;
    position: relative;
    overflow: hidden;
}

.chart-bar-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    height: 100%;
    justify-content: flex-end;
}

.chart-bar-pair {
    display: flex;
    gap: 2px;
    align-items: flex-end;
    width: 100%;
    justify-content: center;
    height: 100%;
}

.bar-receita,
.bar-despesa {
    flex: 1;
    border-radius: 4px 4px 0 0;
    max-width: 18px;
    transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    position: relative;
}

.bar-receita {
    background: linear-gradient(180deg, #34D399, #059669);
}

.bar-despesa {
    background: linear-gradient(180deg, #F87171, #DC2626);
}

.bar-receita:hover,
.bar-despesa:hover {
    filter: brightness(1.15);
    transform: scaleX(1.1);
}

.chart-month-label {
    font-size: 0.6rem;
    color: var(--text-muted);
    font-weight: 700;
    text-align: center;
    margin-top: 6px;
    letter-spacing: 0.03em;
}

.chart-legend {
    display: flex;
    gap: 1.5rem;
    margin-top: 1rem;
    justify-content: center;
}

.chart-legend-item {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.chart-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 3px;
}

/* ----- OCCUPANCY DONUT ----- */
.occupancy-ring {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

.occupancy-ring svg circle {
    transition: stroke-dashoffset 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ----- ENHANCED KPI CARDS ----- */
.kpi-card.kpi-success {
    border-color: rgba(16, 185, 129, 0.2);
}

.kpi-card.kpi-success::before {
    background: linear-gradient(90deg, #10B981, #34D399);
}

.kpi-card.kpi-danger {
    border-color: rgba(239, 68, 68, 0.2);
}

.kpi-card.kpi-danger::before {
    background: linear-gradient(90deg, #EF4444, #F87171);
}

.kpi-card.kpi-purple {
    border-color: rgba(139, 92, 246, 0.2);
}

.kpi-card.kpi-purple::before {
    background: linear-gradient(90deg, #8B5CF6, #A78BFA);
}

.kpi-card.kpi-blue {
    border-color: rgba(14, 165, 233, 0.2);
}

.kpi-card.kpi-blue::before {
    background: linear-gradient(90deg, #0EA5E9, #38BDF8);
}

/* ----- EMPTY STATE ----- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4rem 2rem;
    color: var(--text-muted);
    text-align: center;
    gap: 1rem;
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: 20px;
    background: var(--surface-alt);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 2rem;
    margin-bottom: 0.5rem;
}

.empty-state h3 {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-secondary);
    margin-bottom: 0.25rem;
}

.empty-state p {
    font-size: 0.875rem;
    max-width: 320px;
    line-height: 1.6;
}

/* ----- ENHANCED TABLE ROW EXPAND ----- */
.main-row {
    cursor: pointer;
}

.main-row:hover td {
    background-color: var(--primary-lighter);
}

.details-row td {
    padding: 0 !important;
}

/* ----- INPUT ICON WRAPPER (improved) ----- */
.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-icon-wrapper i {
    position: absolute;
    left: 0.85rem;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    pointer-events: none;
}

.input-icon-wrapper input,
.input-icon-wrapper select {
    padding-left: 2.6rem !important;
    width: 100%;
}

/* ----- AUTOCOMPLETE SUGGESTIONS (enhanced) ----- */
.autocomplete-container {
    position: relative;
}

.suggestion-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    z-index: 1000;
    background: var(--surface);
    border: 1.5px solid var(--primary);
    border-top: none;
    border-radius: 0 0 10px 10px;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.12);
    max-height: 200px;
    overflow-y: auto;
    display: none;
}

.suggestion-list.active {
    display: block;
}

.suggestion-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    cursor: pointer;
    font-size: 0.875rem;
    border-bottom: 1px solid var(--divider);
    transition: background 0.12s;
}

.suggestion-item:last-child {
    border-bottom: none;
}

.suggestion-item:hover {
    background: var(--primary-lighter);
    color: var(--primary);
}

[data-theme="dark"] .suggestion-list {
    border-color: rgba(251, 146, 60, 0.42);
    box-shadow: var(--shadow-lg);
}

[data-theme="dark"] .suggestion-item:hover {
    background: rgba(249, 115, 22, 0.12);
    color: var(--text);
}

.type-badge {
    font-size: 0.7rem;
    font-weight: 700;
    background: var(--primary-lighter);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ----- MODAL FOOTER ----- */
.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--border);
    margin-top: 1.5rem;
}

/* ----- STATUS BADGE ENCERRADO ----- */
.status-encerrado {
    background: #F1F5F9;
    color: #475569;
    border-color: #CBD5E1;
}

.status-manutenção {
    background: #FEF3C7;
    color: #92400E;
    border-color: #FDE68A;
}

/* ----- RESPONSIVE LOGIN ----- */
@media (max-width: 900px) {
    .login-enterprise-left {
        display: none;
    }

    .login-enterprise-right {
        width: 100%;
    }
}

/* ----- PRINT IMPROVEMENTS ----- */
@media print {

    .login-enterprise-left,
    .sidebar {
        display: none !important;
    }
}

/* ----- FORM SECTION IMPROVED LINES ----- */
.form-section-title {
    position: relative;
}

/* ----- LOGO IN SIDEBAR (subtle separation only) ----- */
.sidebar-logo img {
    filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.06));
}

/* ----- SYNC INDICATOR ----- */
#sync-icon {
    color: rgba(203, 213, 225, 0.5) !important;
}

#sync-time {
    color: rgba(203, 213, 225, 0.5) !important;
}

/* ----- PAGE TITLE SUBTITLE ----- */
.page-title p {
    font-size: 0.85rem;
    color: var(--text-tertiary);
}

/* ----- KPI CARD CLICKABLE ----- */
.kpi-card.clickable {
    cursor: pointer;
}

.kpi-card.clickable:hover {
    border-color: color-mix(in srgb, var(--border) 50%, var(--primary-light));
    box-shadow: var(--shadow-md);
}

/* ----- RECEIPT/STATEMENT PRINT IMPROVEMENTS ----- */
@media print {
    body * {
        visibility: hidden;
    }

    .receipt-box,
    .receipt-box * {
        visibility: visible;
    }

    .receipt-box {
        position: fixed;
        top: 0;
        left: 0;
        width: 100%;
    }
}

/* Semantic Alert Cards */
.alert-card {
    width: 100%;
    border-radius: var(--radius-lg);
    padding: 1rem 1.5rem;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 700;
    cursor: default;
    box-shadow: var(--shadow-md);
    border: 2px solid transparent;
    transition: all var(--transition-base);
}

.alert-warning {
    background: var(--primary-lighter);
    color: var(--primary-dark);
    border-color: var(--primary-light);
}

[data-theme="dark"] .alert-warning {
    background: rgba(249, 115, 22, 0.15);
    color: #FB923C;
    border-color: rgba(249, 115, 22, 0.3);
}

.alert-success {
    background: var(--success-light);
    color: #166534;
    border-color: #86efac;
}

[data-theme="dark"] .alert-success {
    background: rgba(16, 185, 129, 0.15);
    color: #34D399;
    border-color: rgba(16, 185, 129, 0.3);
}

.alert-card i {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
}

.total-pagar-container {
    background: var(--surface-alt);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: var(--shadow-sm);
    transition: all var(--transition-base);
    text-align: right;
    display: inline-block;
    min-width: 120px;
}

/* ===== VISUAL UPGRADE V2 (GLOBAL + COMPAT) — tokens em moradiq-tokens.css ===== */

.app-shell-sidebar {
    backdrop-filter: blur(8px);
    border-right: 1px solid color-mix(in srgb, var(--border) 82%, transparent);
}

.app-nav-links {
    gap: 0.375rem;
}

.nav-item-theme {
    margin-top: auto;
    padding-top: 1rem;
    border-top: 1px solid var(--primary-lighter);
}

.nav-link-theme {
    justify-content: center;
}

.nav-link {
    border: 1px solid transparent;
}

.nav-link:hover {
    transform: none;
}

.nav-link:focus-visible,
.btn:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    box-shadow: var(--ring-focus);
    outline: none;
}

.main-content {
    background: linear-gradient(180deg, var(--background) 0%, color-mix(in srgb, var(--surface-muted) 55%, var(--background)) 55%, var(--background) 100%);
}

.page-title h1,
.page-title h2,
.form-header h2 {
    letter-spacing: -0.02em;
}

.table-container {
    border-radius: 14px;
    overflow-x: auto;
    overflow-y: visible;
    border: 1px solid color-mix(in srgb, var(--border) 92%, transparent);
    box-shadow: var(--shadow-sm);
}

.table-container table {
    width: 100%;
}

.table-container thead tr {
    background: color-mix(in srgb, var(--surface-alt) 80%, var(--primary-lighter) 20%);
}

.table-container th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-tertiary);
}

.table-container td {
    border-top: 1px solid var(--divider);
}

.form-container,
.modal-content,
.kpi-card,
.card {
    border-radius: 14px;
    border: 1px solid color-mix(in srgb, var(--border) 92%, transparent);
    box-shadow: var(--shadow-sm);
}

.kpi-card {
    background: linear-gradient(180deg, var(--surface) 0%, var(--surface-alt) 100%);
}

.kpi-value {
    letter-spacing: -0.01em;
}

.btn {
    border-radius: 10px;
    min-height: 38px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-500) 0%, var(--primary-600) 100%);
}

.btn-primary:hover {
    background: linear-gradient(135deg, var(--primary-600) 0%, var(--primary-700) 100%);
}

.btn-secondary {
    background: var(--surface-elevated);
}

.status-badge {
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.01em;
}

/* Compat helpers injected by JS migration */
.ui-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.25rem 0.65rem;
    font-weight: 700;
    font-size: 0.72rem;
}

.ui-inline-flex {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.ui-muted {
    color: var(--text-muted);
}

.ui-danger {
    color: var(--error) !important;
}

.ui-warning {
    color: #b45309 !important;
}

.ui-soft-info {
    background: #eef2ff !important;
    color: #3730a3 !important;
    border: 1px solid #c7d2fe !important;
    border-radius: 10px !important;
    padding: 1rem !important;
}

.ui-icon-xs {
    width: 12px !important;
    height: 12px !important;
}

.ui-icon-sm {
    width: 16px !important;
    height: 16px !important;
}

.ui-icon-md {
    width: 18px !important;
    height: 18px !important;
}

.ui-icon-lg {
    width: 20px !important;
    height: 20px !important;
}

.ui-clickable {
    cursor: pointer !important;
}

.ui-grid-main {
    display: grid;
    grid-template-columns: 1fr 300px;
    gap: 1.5rem;
    align-items: start;
    margin-top: 2rem;
}

.ui-kpi-accent-danger .kpi-value {
    color: var(--error) !important;
}

.ui-mt-xl {
    margin-top: 2.5rem !important;
}

.ui-table-mt {
    margin-top: 1rem !important;
}

.ui-btn-compact {
    padding: 0.5rem 1rem !important;
    font-size: 0.75rem !important;
}

.user-avatar-compact {
    width: 32px;
    height: 32px;
    font-size: 0.8rem;
    flex-shrink: 0;
}

.logout-link {
    cursor: pointer;
    opacity: 0.6;
    color: var(--text-muted);
    transition: opacity var(--transition-fast), color var(--transition-fast);
}

.logout-link:hover {
    opacity: 1;
    color: var(--primary);
}

.custom-confirm-box-input {
    border-top-color: var(--primary);
}

.custom-confirm-icon-input {
    background: var(--primary-lighter);
    color: var(--primary);
}

.custom-confirm-msg-input {
    margin-bottom: 1rem;
}

.custom-input-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 6px;
    display: block;
}

.custom-input-date {
    width: 100%;
    padding: 0.75rem 1rem;
    border-radius: 8px;
    border: 1.5px solid var(--border);
    font-size: 0.95rem;
    background: var(--surface);
    color: var(--text);
}

.dashboard-alert-text {
    flex-grow: 1;
    font-size: 1rem;
}

.dashboard-backup-btn {
    margin-left: auto;
}

.dashboard-title-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.dashboard-col-date {
    width: 100px;
}

.dashboard-col-value {
    width: 150px;
    text-align: right;
}

.dashboard-empty-row {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
}

.dashboard-date-cell {
    padding: 0.85rem 1rem;
    color: var(--text-secondary);
    font-size: 0.8rem;
}

.dashboard-desc-cell {
    padding: 0.85rem 1rem;
    font-weight: 600;
    font-size: 0.85rem;
}

.dashboard-value-cell {
    padding: 0.85rem 1rem;
    text-align: right;
    font-weight: 700;
    font-size: 0.85rem;
}

.dashboard-value-cell.is-credit {
    color: var(--success);
}

.dashboard-value-cell.is-debit {
    color: var(--error);
}

.logs-container-hidden {
    display: none;
}

.logs-col-datetime {
    width: 180px;
}

.logs-col-user {
    width: 150px;
}

.logs-col-action {
    width: 120px;
}

.logs-date-cell {
    padding: 1rem;
    white-space: nowrap;
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.logs-cell {
    padding: 1rem;
}

.logs-user-badge {
    background: #f1f5f9;
    color: #475569;
    font-size: 0.75rem;
}

/* ===== DARK MODE CONTRAST FIXES ===== */
[data-theme="dark"] .status-pago {
    background: rgba(16, 185, 129, 0.16);
    color: #6ee7b7;
    border-color: rgba(16, 185, 129, 0.35);
}

[data-theme="dark"] .status-carência {
    background: rgba(99, 102, 241, 0.18);
    color: #c7d2fe;
    border-color: rgba(129, 140, 248, 0.38);
}

[data-theme="dark"] .status-atrasado {
    background: rgba(239, 68, 68, 0.16);
    color: #fca5a5;
    border-color: rgba(248, 113, 113, 0.4);
}

[data-theme="dark"] .status-em_aberto {
    background: rgba(245, 158, 11, 0.16);
    color: #fcd34d;
    border-color: rgba(251, 191, 36, 0.36);
}

[data-theme="dark"] .status-ativo {
    background: rgba(6, 182, 212, 0.16);
    color: #67e8f9;
    border-color: rgba(34, 211, 238, 0.36);
}

[data-theme="dark"] .status-inativo,
[data-theme="dark"] .status-encerrado,
[data-theme="dark"] .logs-user-badge {
    background: rgba(148, 163, 184, 0.16);
    color: #cbd5e1;
    border-color: rgba(148, 163, 184, 0.32);
}

[data-theme="dark"] .status-manutenção {
    background: rgba(245, 158, 11, 0.14);
    color: #fbbf24;
    border-color: rgba(245, 158, 11, 0.32);
}

[data-theme="dark"] .reajustes-kpi-today .kpi-value {
    color: #fdba74;
}

[data-theme="dark"] .reajustes-kpi-overdue .kpi-value {
    color: #fda4af;
}

[data-theme="dark"] .reajustes-kpi-upcoming .kpi-value {
    color: #7dd3fc;
}

[data-theme="dark"] .reajustes-indice {
    color: #c7d2fe;
    background: rgba(99, 102, 241, 0.18);
    border-color: rgba(129, 140, 248, 0.38);
}

[data-theme="dark"] .reajuste-status-chip.is-overdue {
    color: #fca5a5;
    background: rgba(239, 68, 68, 0.16);
    border-color: rgba(248, 113, 113, 0.4);
}

[data-theme="dark"] .reajuste-status-chip.is-today {
    color: #fdba74;
    background: rgba(249, 115, 22, 0.18);
    border-color: rgba(251, 146, 60, 0.38);
}

[data-theme="dark"] .reajuste-status-chip.is-upcoming {
    color: #7dd3fc;
    background: rgba(14, 165, 233, 0.16);
    border-color: rgba(56, 189, 248, 0.36);
}

[data-theme="dark"] .alert-success {
    background: rgba(16, 185, 129, 0.14);
    color: #6ee7b7;
}

[data-theme="dark"] .alert-error {
    background: rgba(239, 68, 68, 0.14);
    color: #fca5a5;
}

[data-theme="dark"] .alert-warning {
    background: rgba(245, 158, 11, 0.14);
    color: #fcd34d;
}

[data-theme="dark"] .alert-info {
    background: rgba(6, 182, 212, 0.14);
    color: #67e8f9;
}

/* ===== DARK — telas inteiras (#main-view) com cores fixas vindas do app.js ===== */

[data-theme="dark"] #main-view [style*="f8fafc"],
[data-theme="dark"] #main-view [style*="F8FAFC"] {
    background: rgba(148, 163, 184, 0.1) !important;
    background-image: none !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] #main-view [style*="f1f5f9"],
[data-theme="dark"] #main-view [style*="F1F5F9"] {
    background: rgba(148, 163, 184, 0.12) !important;
    background-image: none !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] #main-view [style*="f3f4f6"],
[data-theme="dark"] #main-view [style*="F3F4F6"] {
    background: rgba(148, 163, 184, 0.14) !important;
    color: var(--text-secondary) !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] #main-view [style*="f0fdf4"],
[data-theme="dark"] #main-view [style*="F0FDF4"],
[data-theme="dark"] #main-view [style*="ecfdf5"],
[data-theme="dark"] #main-view [style*="ECFDF5"] {
    background: rgba(16, 185, 129, 0.12) !important;
    background-image: none !important;
    border-color: rgba(16, 185, 129, 0.28) !important;
    color: #d1fae5 !important;
}

[data-theme="dark"] #main-view [style*="dcfce7"],
[data-theme="dark"] #main-view [style*="DCFCE7"] {
    background: rgba(34, 197, 94, 0.14) !important;
    color: #bbf7d0 !important;
    border-color: rgba(34, 197, 94, 0.35) !important;
}

[data-theme="dark"] #main-view [style*="eff6ff"],
[data-theme="dark"] #main-view [style*="EFF6FF"],
[data-theme="dark"] #main-view [style*="f0f9ff"],
[data-theme="dark"] #main-view [style*="F0F9FF"] {
    background: rgba(59, 130, 246, 0.14) !important;
    background-image: none !important;
    border-color: rgba(96, 165, 250, 0.32) !important;
    color: #dbeafe !important;
}

[data-theme="dark"] #main-view [style*="dbeafe"],
[data-theme="dark"] #main-view [style*="DBEAFE"],
[data-theme="dark"] #main-view [style*="e0f2fe"],
[data-theme="dark"] #main-view [style*="E0F2FE"] {
    background: rgba(14, 165, 233, 0.14) !important;
    color: #bae6fd !important;
    border-color: rgba(56, 189, 248, 0.32) !important;
}

[data-theme="dark"] #main-view [style*="fff7ed"],
[data-theme="dark"] #main-view [style*="FFF7ED"],
[data-theme="dark"] #main-view [style*="ffedd5"],
[data-theme="dark"] #main-view [style*="FFEDD5"] {
    background: rgba(249, 115, 22, 0.12) !important;
    background-image: none !important;
    border-color: rgba(251, 146, 60, 0.32) !important;
    color: #fed7aa !important;
}

[data-theme="dark"] #main-view [style*="fffbeb"],
[data-theme="dark"] #main-view [style*="FFFBEB"],
[data-theme="dark"] #main-view [style*="fef3c7"],
[data-theme="dark"] #main-view [style*="FEF3C7"],
[data-theme="dark"] #main-view [style*="fde68a"],
[data-theme="dark"] #main-view [style*="FDE68A"] {
    background: rgba(245, 158, 11, 0.12) !important;
    background-image: none !important;
    border-color: rgba(251, 191, 36, 0.32) !important;
    color: #fde68a !important;
}

[data-theme="dark"] #main-view [style*="fef9c3"],
[data-theme="dark"] #main-view [style*="FEF9C3"] {
    background: rgba(234, 179, 8, 0.14) !important;
    color: #fef08a !important;
    border-color: rgba(234, 179, 8, 0.3) !important;
}

[data-theme="dark"] #main-view [style*="fff1f2"],
[data-theme="dark"] #main-view [style*="FFF1F2"],
[data-theme="dark"] #main-view [style*="fee2e2"],
[data-theme="dark"] #main-view [style*="FEE2E2"],
[data-theme="dark"] #main-view [style*="fecaca"],
[data-theme="dark"] #main-view [style*="FECACA"] {
    background: rgba(239, 68, 68, 0.12) !important;
    background-image: none !important;
    border-color: rgba(248, 113, 113, 0.32) !important;
    color: #fecaca !important;
}

[data-theme="dark"] #main-view [style*="fdf2f8"],
[data-theme="dark"] #main-view [style*="FDF2F8"] {
    background: rgba(244, 114, 182, 0.14) !important;
    color: #fbcfe8 !important;
    border-color: rgba(244, 114, 182, 0.32) !important;
}

[data-theme="dark"] #main-view [style*="eef2ff"],
[data-theme="dark"] #main-view [style*="EEF2FF"],
[data-theme="dark"] #main-view [style*="ede9fe"],
[data-theme="dark"] #main-view [style*="EDE9FE"],
[data-theme="dark"] #main-view [style*="faf5ff"],
[data-theme="dark"] #main-view [style*="FAF5FF"] {
    background: rgba(139, 92, 246, 0.14) !important;
    color: #e9d5ff !important;
    border-color: rgba(167, 139, 250, 0.32) !important;
}

[data-theme="dark"] #main-view [style*="ffffff"],
[data-theme="dark"] #main-view [style*="FFFFFF"],
[data-theme="dark"] #main-view [style*="#fff;"],
[data-theme="dark"] #main-view [style*="background:#fff"] {
    background: rgba(30, 41, 59, 0.75) !important;
    background-image: none !important;
    border-color: var(--border) !important;
}

[data-theme="dark"] #main-view [style*="f59e0b"],
[data-theme="dark"] #main-view [style*="F59E0B"],
[data-theme="dark"] #main-view [style*="#bbf7d0"],
[data-theme="dark"] #main-view [style*="#bae6fd"] {
    border-color: rgba(251, 191, 36, 0.35) !important;
}

[data-theme="dark"] #main-view .kpi-icon[style] {
    filter: brightness(1.05) saturate(0.92);
}

[data-theme="dark"] #main-view .kpi-value[style*="059669"],
[data-theme="dark"] #main-view .kpi-value[style*="065f46"] {
    color: #6ee7b7 !important;
}

[data-theme="dark"] #main-view .status-badge[style*="166534"],
[data-theme="dark"] #main-view .status-badge[style*="065f46"] {
    background: rgba(16, 185, 129, 0.16) !important;
    color: #6ee7b7 !important;
    border-color: rgba(16, 185, 129, 0.32) !important;
}

[data-theme="dark"] #main-view .status-badge[style*="5B21B6"],
[data-theme="dark"] #main-view .status-badge[style*="6b21a8"] {
    background: rgba(139, 92, 246, 0.16) !important;
    color: #e9d5ff !important;
    border-color: rgba(167, 139, 250, 0.32) !important;
}

[data-theme="dark"] #main-view small[style*="64748b"] {
    color: var(--text-tertiary) !important;
}

[data-theme="dark"] #main-view [style*="#78250f"],
[data-theme="dark"] #main-view [style*="#78350f"],
[data-theme="dark"] #main-view [style*="#92400e"] {
    color: #fde68a !important;
}

[data-theme="dark"] #main-view [style*="c2410c"],
[data-theme="dark"] #main-view [style*="C2410C"] {
    color: #fdba74 !important;
}

[data-theme="dark"] #main-view [style*="9a3412"],
[data-theme="dark"] #main-view [style*="9A3412"] {
    color: #fed7aa !important;
}

[data-theme="dark"] #main-view [style*="1e40af"],
[data-theme="dark"] #main-view [style*="1E40AF"],
[data-theme="dark"] #main-view [style*="0369a1"],
[data-theme="dark"] #main-view [style*="0369A1"] {
    color: #bae6fd !important;
}

[data-theme="dark"] #main-view [style*="991b1b"],
[data-theme="dark"] #main-view [style*="991B1B"] {
    color: #fca5a5 !important;
}

[data-theme="dark"] #main-view [style*="7C3AED"],
[data-theme="dark"] #main-view [style*="7c3aed"],
[data-theme="dark"] #main-view [style*="2563eb"] {
    color: #c4b5fd !important;
}

[data-theme="dark"] .ui-soft-info {
    background: rgba(99, 102, 241, 0.16) !important;
    color: #c7d2fe !important;
    border-color: rgba(129, 140, 248, 0.38) !important;
}

[data-theme="dark"] .login-error-msg {
    background: rgba(239, 68, 68, 0.12) !important;
    border-color: rgba(248, 113, 113, 0.35) !important;
    color: #fecaca !important;
}

[data-theme="dark"] .aluguel-pago-overlay {
    background: rgba(2, 6, 23, 0.62) !important;
}

[data-theme="dark"] .aluguel-pago-popup {
    background: linear-gradient(160deg, rgba(6, 78, 59, 0.45) 0%, rgba(15, 23, 42, 0.92) 55%, rgba(15, 118, 110, 0.25) 100%) !important;
    border-color: rgba(52, 211, 153, 0.45) !important;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

[data-theme="dark"] .aluguel-pago-popup .aluguel-pago-check-ring {
    fill: rgba(52, 211, 153, 0.9) !important;
}

[data-theme="dark"] .aluguel-pago-popup .aluguel-pago-title {
    color: #a7f3d0 !important;
}

[data-theme="dark"] .custom-confirm-overlay {
    background: rgba(2, 6, 23, 0.68) !important;
}

[data-theme="dark"] .custom-confirm-icon {
    background: rgba(245, 158, 11, 0.16) !important;
    color: #fcd34d !important;
}

[data-theme="dark"] .custom-confirm-icon.danger {
    background: rgba(239, 68, 68, 0.14) !important;
    color: #fca5a5 !important;
}

[data-theme="dark"] .custom-confirm-icon-input {
    background: rgba(249, 115, 22, 0.16) !important;
    color: #fdba74 !important;
}

[data-theme="dark"] #main-view [style*="fefce8"],
[data-theme="dark"] #main-view [style*="FEFCE8"] {
    background: rgba(234, 179, 8, 0.12) !important;
    color: #fde047 !important;
    border-color: rgba(250, 204, 21, 0.28) !important;
}

[data-theme="dark"] #main-view [style*="fef2f2"],
[data-theme="dark"] #main-view [style*="FEF2F2"] {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #fecaca !important;
}

[data-theme="dark"] #main-view [style*="background: #fff"],
[data-theme="dark"] #main-view [style*="background:#fff"] {
    background: rgba(30, 41, 59, 0.72) !important;
    color: var(--text) !important;
}

[data-theme="dark"] #main-view [style*="475569"],
[data-theme="dark"] #main-view [style*="374151"] {
    color: var(--text-secondary) !important;
}

[data-theme="dark"] #main-view [style*="ea580c"],
[data-theme="dark"] #main-view [style*="EA580C"] {
    color: #fdba74 !important;
}

[data-theme="dark"] #main-view [style*="b45309"],
[data-theme="dark"] #main-view [style*="B45309"] {
    color: #fcd34d !important;
}

[data-theme="dark"] #main-view [style*="059669"],
[data-theme="dark"] #main-view [style*="065f46"],
[data-theme="dark"] #main-view [style*="065F46"] {
    color: #6ee7b7 !important;
}

[data-theme="dark"] #main-view [style*="dc2626"],
[data-theme="dark"] #main-view [style*="DC2626"],
[data-theme="dark"] #main-view [style*="ef4444"],
[data-theme="dark"] #main-view [style*="EF4444"] {
    color: #fca5a5 !important;
}

[data-theme="dark"] #main-view [style*="0ea5e9"],
[data-theme="dark"] #main-view [style*="0EA5E9"],
[data-theme="dark"] #main-view [style*="0284c7"],
[data-theme="dark"] #main-view [style*="0284C7"] {
    color: #38bdf8 !important;
}

[data-theme="dark"] #main-view [style*="D1FAE5"],
[data-theme="dark"] #main-view [style*="d1fae5"] {
    background: rgba(16, 185, 129, 0.16) !important;
    color: #6ee7b7 !important;
    border-color: rgba(16, 185, 129, 0.3) !important;
}

[data-theme="dark"] #main-view [style*="E0F2FE"],
[data-theme="dark"] #main-view [style*="e0f2fe"] {
    background: rgba(14, 165, 233, 0.16) !important;
    color: #7dd3fc !important;
}

[data-theme="dark"] #main-view [style*="d97706"],
[data-theme="dark"] #main-view [style*="D97706"] {
    color: #fcd34d !important;
}

[data-theme="dark"] #main-view [style*="6b21a8"],
[data-theme="dark"] #main-view [style*="6B21A8"] {
    color: #e9d5ff !important;
}

[data-theme="dark"] #main-view [style*="94a3b8"],
[data-theme="dark"] #main-view [style*="94A3B8"] {
    color: var(--text-muted) !important;
}

[data-theme="dark"] #main-view [style*="1e293b"],
[data-theme="dark"] #main-view [style*="1E293B"],
[data-theme="dark"] #main-view [style*="0f172a"],
[data-theme="dark"] #main-view [style*="0F172A"] {
    color: var(--text) !important;
}

[data-theme="dark"] #main-view [style*="7c2d12"],
[data-theme="dark"] #main-view [style*="7C2D12"] {
    color: #fed7aa !important;
}

[data-theme="dark"] #main-view [style*="1e3a8a"],
[data-theme="dark"] #main-view [style*="1E3A8A"],
[data-theme="dark"] #main-view [style*="3b82f6"],
[data-theme="dark"] #main-view [style*="3B82F6"] {
    color: #93c5fd !important;
}

[data-theme="dark"] #main-view [style*="FEE2E2"],
[data-theme="dark"] #main-view [style*="fee2e2"],
[data-theme="dark"] #main-view [style*="fecaca"],
[data-theme="dark"] #main-view [style*="FECACA"] {
    background: rgba(239, 68, 68, 0.12) !important;
    color: #fecaca !important;
    border-color: rgba(248, 113, 113, 0.35) !important;
}

[data-theme="dark"] #main-view [style*="F3F4F6"],
[data-theme="dark"] #main-view [style*="f3f4f6"] {
    background: rgba(148, 163, 184, 0.12) !important;
    color: var(--text-secondary) !important;
}

[data-theme="dark"] .custom-confirm-box[style*="6366f1"] {
    border-top-color: #818cf8 !important;
}

[data-theme="dark"] .custom-confirm-icon[style*="EEF2FF"],
[data-theme="dark"] .custom-confirm-icon[style*="eef2ff"] {
    background: rgba(99, 102, 241, 0.2) !important;
    color: #c7d2fe !important;
}

[data-theme="dark"] .confirm-btn-ok[style*="6366f1"],
[data-theme="dark"] #main-view .confirm-btn-ok[style*="6366f1"] {
    background: linear-gradient(135deg, #6366f1, #4f46e5) !important;
    color: #fff !important;
}

.logs-details-cell {
    font-size: 0.85rem;
}

.logs-empty-row {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

/* ===== CONTRATOS - DETALHES MAIS LEVES ===== */
.contract-details-grid {
    gap: 1rem !important;
    padding: 1rem !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
}

.contract-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
}

.contract-section-toggle {
    width: 100%;
    border: none;
    background: color-mix(in srgb, var(--surface-alt) 72%, var(--surface));
    color: var(--text);
    padding: 0.75rem 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    font-weight: 700;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.contract-section-label {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
}

.contract-section-label i {
    color: var(--primary);
}

.contract-section-chevron {
    transition: transform var(--transition-fast);
}

.contract-section.is-open .contract-section-chevron {
    transform: rotate(180deg);
}

.contract-section-content {
    padding: 0.85rem;
    gap: 0.6rem !important;
    font-size: 0.85rem !important;
}

.contract-details-actions {
    padding: 0.9rem !important;
    flex-wrap: wrap;
    gap: 0.75rem !important;
}

.contract-details-actions > div {
    flex-wrap: wrap;
}

/* ===== REBRAND V3 - SAAS NEUTRO ===== */
body.moradiq-app {
    background: var(--background);
}

body.moradiq-app .app-container {
    gap: 0;
    padding: 0;
}

body.moradiq-app .sidebar {
    width: 268px;
    min-width: 268px;
    border-radius: 0;
    box-shadow: none;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 0 !important;
    min-height: 0;
}

body.moradiq-app .sidebar-top {
    flex-shrink: 0;
}

body.moradiq-app .sidebar-logo {
    padding: var(--space-md);
    margin-bottom: 0 !important;
    border-bottom: none;
    flex: 1;
    min-width: 0;
}

body.moradiq-app .sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 0 var(--space-sm) var(--space-sm);
}

body.moradiq-app .sidebar-bottom {
    flex-shrink: 0;
    padding: 0 var(--space-sm) var(--space-sm);
    border-top: 1px solid var(--border);
    background: color-mix(in srgb, var(--surface) 92%, var(--background));
}

body.moradiq-app .nav-links {
    padding: 0;
    flex-grow: 0;
    gap: 0.35rem;
}

body.moradiq-app .nav-link {
    min-height: 42px;
    border-left: none !important;
    border-radius: 10px;
}

body.moradiq-app .nav-link.active {
    border: 1px solid color-mix(in srgb, var(--primary) 40%, transparent);
    background: linear-gradient(90deg, color-mix(in srgb, var(--primary-lighter) 70%, transparent), transparent) !important;
}

/* Light mode override for enterprise sidebar rules */
[data-theme="light"] body.moradiq-app .nav-link,
body.moradiq-app[data-theme="light"] .nav-link {
    color: var(--text-secondary) !important;
}

[data-theme="light"] body.moradiq-app .nav-link i,
body.moradiq-app[data-theme="light"] .nav-link i {
    color: var(--text-tertiary) !important;
    opacity: 1;
}

[data-theme="light"] body.moradiq-app .nav-link.active,
body.moradiq-app[data-theme="light"] .nav-link.active {
    color: var(--primary-dark) !important;
    background: linear-gradient(90deg, color-mix(in srgb, var(--primary-lighter) 56%, var(--surface) 44%), var(--surface)) !important;
    border-color: color-mix(in srgb, var(--primary) 26%, var(--border)) !important;
}

[data-theme="light"] body.moradiq-app .nav-link.active i,
body.moradiq-app[data-theme="light"] .nav-link.active i {
    color: var(--primary) !important;
}

body.moradiq-app .main-content {
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 1.25rem 1.5rem 1.75rem;
    flex: 1;
    min-width: 0;
    overflow-y: auto;
}

.rebrand-view-shell {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-height: 100%;
}

.rebrand-view-topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1rem;
    background: color-mix(in srgb, var(--surface) 92%, var(--background));
    border: 1px solid var(--border);
    border-radius: 12px;
    position: sticky;
    top: 0;
    z-index: 4;
    backdrop-filter: blur(8px);
}

.rebrand-view-title {
    display: flex;
    flex-direction: column;
    gap: 0.125rem;
}

.rebrand-view-title strong {
    font-size: 0.9rem;
    color: var(--text);
}

.rebrand-view-title span {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.rebrand-view-actions {
    display: inline-flex;
    gap: 0.5rem;
    align-items: center;
}

.rebrand-quick-action {
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-secondary);
    border-radius: 999px;
    padding: 0.35rem 0.75rem;
    font-size: 0.72rem;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
}

.rebrand-quick-action:hover {
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 45%, var(--border));
}

body.moradiq-app .header-context {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.1rem;
}

body.moradiq-app .kpi-grid,
body.moradiq-app .reajustes-kpi-grid {
    gap: 1rem;
}

body.moradiq-app .kpi-card {
    padding: 1.25rem;
}

body.moradiq-app .table-container {
    border-radius: 12px;
}

body.moradiq-app .form-container,
body.moradiq-app .card {
    padding: 1.1rem 1.25rem;
}

body.moradiq-app .form-grid {
    gap: 0.9rem;
}

.mobile-nav-toggle {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 1200;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--primary), var(--primary-hover));
    color: #fff;
    font-weight: 700;
    padding: 0.65rem 0.9rem;
    display: none;
    align-items: center;
    gap: 0.35rem;
    box-shadow: var(--shadow-lg);
}

@media (max-width: 1080px) {
    body.moradiq-app .app-container {
        padding: 0.75rem;
        gap: 0.75rem;
    }

    body.moradiq-app .sidebar {
        width: 250px;
    }

    body.moradiq-app .main-content {
        padding: 1rem;
    }
}

@media (max-width: 900px) {
    body.moradiq-app .app-container {
        display: block;
        padding: 0;
    }

    body.moradiq-app .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(84vw, 320px);
        transform: translateX(-105%);
        transition: transform var(--transition-base);
        border-radius: 0;
        z-index: 1100;
    }

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

    body.moradiq-app .main-content {
        border-radius: 0;
        border: none;
        box-shadow: none;
        height: 100vh;
        padding: 0.75rem;
    }

    .mobile-nav-toggle {
        display: inline-flex;
    }

    .rebrand-view-topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .contract-details-grid {
        grid-template-columns: 1fr !important;
    }
}

/* ===== CONTROLE MENSAL ===== */
.controle-mensal-view .header-context.controle-header {
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 1rem;
}

.controle-mensal-view .controle-header-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
    align-items: center;
    justify-content: flex-end;
    flex: 1 1 320px;
    min-width: 0;
}

.controle-mensal-view .controle-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.65rem;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 0.8rem;
}

.controle-mensal-view .controle-filter-chip select {
    border: none;
    outline: none;
    background: transparent;
    font-size: 0.8rem;
    max-width: 100%;
}

.controle-scroll-hint {
    display: none;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0 0 0.5rem;
}

.controle-table-container {
    overflow-x: auto !important;
    overflow-y: visible !important;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-lg);
}

.controle-table-container::-webkit-scrollbar {
    height: 8px;
}

.controle-table-container::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--primary) 35%, var(--border));
    border-radius: 4px;
}

.controle-table {
    width: 100%;
    min-width: 920px;
    table-layout: auto;
}

.controle-table th,
.controle-table td {
    vertical-align: top;
    padding: 0.65rem 0.55rem;
    font-size: 0.8rem;
    line-height: 1.35;
}

.controle-table thead th {
    white-space: nowrap;
    position: sticky;
    top: 0;
    z-index: 2;
    background: color-mix(in srgb, var(--surface-alt) 80%, var(--primary-lighter) 20%);
    box-shadow: 0 1px 0 var(--border);
}

.controle-table .col-expand {
    width: 36px;
    min-width: 36px;
}

.controle-table .col-inquilino {
    min-width: 110px;
    max-width: 160px;
}

.controle-table .col-inquilino .inquilino-nome {
    font-weight: 600;
    word-break: break-word;
}

.controle-table .col-venc,
.controle-table .col-pagamento {
    min-width: 88px;
    white-space: nowrap;
}

.controle-table .col-status {
    min-width: 118px;
}

.controle-table .col-status .status-stack {
    display: flex;
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
}

.controle-table .col-status .status-badge {
    font-size: 0.65rem;
    padding: 2px 6px;
    white-space: nowrap;
}

.controle-table .col-multa {
    min-width: 95px;
}

.controle-table .col-money {
    min-width: 88px;
    white-space: nowrap;
}

.controle-table .col-total {
    min-width: 100px;
}

.controle-table .col-repasse {
    min-width: 100px;
}

.controle-table .col-acoes {
    min-width: 260px;
    width: 28%;
}

.controle-table tr.main-row td {
    border-bottom: 1px solid var(--divider);
}

.controle-table tr.details-row td {
    padding: 0;
    background: var(--surface-alt);
}

.controle-table .total-pagar-container {
    line-height: 1.3;
}

/* Painel de pagamento (etapas) */
.ctrl-pay-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.65rem;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    min-width: 240px;
    max-width: 100%;
}

.ctrl-pay-panel--etapa1 {
    border-color: #fde68a;
    background: linear-gradient(180deg, #fffbeb 0%, var(--surface) 100%);
}

.ctrl-pay-panel--etapa2 {
    border-color: #bfdbfe;
    background: linear-gradient(180deg, #eff6ff 0%, var(--surface) 100%);
}

.ctrl-pay-panel--concluido {
    border-color: #bbf7d0;
    background: linear-gradient(180deg, #ecfdf5 0%, var(--surface) 100%);
}

.ctrl-pay-step {
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    line-height: 1.3;
}

.ctrl-pay-step--ok { color: #059669; }
.ctrl-pay-step--info { color: #0369a1; }
.ctrl-pay-step--warn { color: #b45309; }

.ctrl-pay-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.55rem;
}

.ctrl-pay-field label {
    display: block;
    font-size: 0.62rem;
    color: var(--text-muted);
    margin-bottom: 3px;
    font-weight: 600;
}

.ctrl-pay-field input[type="datetime-local"] {
    width: 100%;
    max-width: 100%;
    padding: 0.35rem 0.45rem;
    font-size: 0.72rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-sizing: border-box;
}

.ctrl-pay-proofs {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ctrl-pay-proofs .btn {
    padding: 0.25rem 0.45rem;
    font-size: 0.65rem;
}

.ctrl-pay-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.ctrl-pay-actions .btn {
    font-size: 0.68rem;
    padding: 0.3rem 0.5rem;
    white-space: nowrap;
}

.ctrl-pay-actions .btn i,
.ctrl-pay-actions .btn [data-lucide] {
    width: 13px;
    height: 13px;
}

.ctrl-pay-receipts {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

@media (max-width: 1400px) {
    .controle-scroll-hint {
        display: flex;
    }

    .controle-table {
        min-width: 880px;
    }

    .controle-table .col-acoes {
        min-width: 200px;
    }
}

@media (max-width: 1200px) {
    .controle-mensal-view .controle-header-filters {
        width: 100%;
        justify-content: flex-start;
    }

    .controle-table {
        min-width: 780px;
    }

    .controle-table th,
    .controle-table td {
        padding: 0.55rem 0.45rem;
        font-size: 0.75rem;
    }

    .ctrl-pay-panel {
        min-width: 220px;
    }
}

/* ===== Sidebar v4: seções recolhíveis + modo compacto ===== */
.sidebar-top {
    display: flex;
    align-items: flex-start;
    gap: 0.35rem;
    padding: var(--space-sm) var(--space-sm) 0;
    border-bottom: 1px solid var(--border);
}

.sidebar-collapse-btn {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    margin-top: 0.35rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--surface-alt);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.sidebar-collapse-btn:hover {
    background: var(--primary-lighter);
    color: var(--primary);
    border-color: color-mix(in srgb, var(--primary) 35%, var(--border));
}

.sidebar-scroll {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
}

.sidebar-bottom .sidebar-footer {
    margin-top: 0;
    padding: 0.75rem 0 0;
    border-top: none;
}

.sidebar-theme-row {
    margin-top: 0;
    padding-top: 0.5rem;
    border-top: none !important;
}

.sidebar-imob-name {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-top: 0.35rem;
    text-align: center;
    line-height: 1.35;
    word-break: break-word;
    overflow-wrap: anywhere;
    max-height: 2.8em;
    overflow: hidden;
}

.nav-link-label {
    flex: 1;
    min-width: 0;
    line-height: 1.3;
    white-space: normal;
    word-break: break-word;
}

.nav-section {
    margin-bottom: 0.25rem;
}

.nav-section-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.45rem 0.55rem;
    margin-top: 0.35rem;
    border: none;
    border-radius: var(--radius-md);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s;
}

.nav-section-toggle:hover {
    background: var(--surface-alt);
    color: var(--text-secondary);
}

.nav-section-chevron {
    width: 16px !important;
    height: 16px !important;
    flex-shrink: 0;
    transition: transform 0.2s ease;
}

.nav-section.is-collapsed .nav-section-chevron {
    transform: rotate(-90deg);
}

.nav-section-items {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding-left: 0.15rem;
    overflow: hidden;
    max-height: 800px;
    opacity: 1;
    transition: max-height 0.28s ease, opacity 0.2s ease;
}

.nav-section.is-collapsed .nav-section-items {
    max-height: 0;
    opacity: 0;
    pointer-events: none;
}

.nav-impersonate-banner {
    background: var(--warning-bg, #fef3c7);
    color: var(--warning-text, #92400e);
    padding: 0.65rem 0.75rem;
    margin: 0 0 0.65rem;
    border-radius: 8px;
    font-size: 0.75rem;
    line-height: 1.35;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    word-break: break-word;
}

.nav-impersonate-banner span {
    overflow-wrap: anywhere;
}

/* Modo compacto (só ícones) */
body.sidebar-collapsed .sidebar,
body.moradiq-app.sidebar-collapsed .sidebar {
    width: 84px !important;
    min-width: 84px !important;
}

body.sidebar-collapsed .sidebar-top {
    flex-direction: column;
    align-items: center;
    padding-bottom: 0.5rem;
}

body.sidebar-collapsed .sidebar-logo img {
    max-height: 48px;
}

body.sidebar-collapsed .sidebar-imob-name,
body.sidebar-collapsed .nav-section-toggle,
body.sidebar-collapsed .nav-link-label,
body.sidebar-collapsed .user-details,
body.sidebar-collapsed .sync-info span,
body.sidebar-collapsed #theme-text {
    display: none !important;
}

body.sidebar-collapsed .nav-section.is-collapsed .nav-section-items {
    max-height: none;
    opacity: 1;
    pointer-events: auto;
}

body.sidebar-collapsed .nav-section-items {
    max-height: none !important;
    opacity: 1 !important;
    pointer-events: auto !important;
}

body.sidebar-collapsed .nav-link {
    justify-content: center;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

body.sidebar-collapsed .nav-impersonate-banner .btn {
    font-size: 0.65rem;
    padding: 0.25rem 0.4rem;
}

body.sidebar-collapsed .user-compact {
    justify-content: center;
}

body.sidebar-collapsed .logout-link {
    display: none;
}

body.sidebar-collapsed .sidebar-sync-bar {
    justify-content: center;
    padding: 0.4rem;
}

@media (max-width: 768px) {
    body.sidebar-collapsed .sidebar,
    body.moradiq-app.sidebar-collapsed .sidebar {
        width: 100% !important;
        min-width: 0 !important;
    }

    body.sidebar-collapsed .nav-link-label,
    body.sidebar-collapsed .nav-section-toggle,
    body.sidebar-collapsed .user-details {
        display: flex !important;
    }

    body.sidebar-collapsed .nav-section-toggle {
        display: flex !important;
    }

    body.sidebar-collapsed .nav-link-label {
        display: inline !important;
    }
}