/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary: #4f46e5;
    --primary-dark: #4338ca;
    --primary-light: #eef2ff;
    --secondary: #64748b;
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;
    --bg: #f8fafc;
    --surface: #ffffff;
    --border: #e2e8f0;
    --text: #1e293b;
    --text-muted: #64748b;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.1), 0 2px 4px -2px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
    --radius: 10px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ===== DARK MODE ===== */
body.dark {
    --primary: #818cf8;
    --primary-dark: #6366f1;
    --primary-light: #1e1b4b;
    --secondary: #94a3b8;
    --success: #34d399;
    --danger: #f87171;
    --warning: #fbbf24;
    --bg: #0f172a;
    --surface: #1e293b;
    --border: #334155;
    --text: #f1f5f9;
    --text-muted: #94a3b8;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 4px 6px -1px rgba(0,0,0,0.4), 0 2px 4px -2px rgba(0,0,0,0.4);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.5), 0 4px 6px -4px rgba(0,0,0,0.5);
}

.theme-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    line-height: 1;
    transition: background 0.15s;
}
.theme-btn:hover { background: rgba(128,128,128,0.15); }

/* ===== LOGIN ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    position: relative;
    overflow: hidden;
}

/* Orbs decorativos de fundo */
.login-container::before,
.login-container::after {
    content: '';
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.35;
    pointer-events: none;
}
.login-container::before {
    width: 500px; height: 500px;
    background: radial-gradient(circle, #6366f1, #8b5cf6);
    top: -120px; left: -120px;
}
.login-container::after {
    width: 400px; height: 400px;
    background: radial-gradient(circle, #ec4899, #f43f5e);
    bottom: -100px; right: -100px;
}

.login-box {
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
    padding: 44px 40px;
    width: 100%;
    max-width: 420px;
    position: relative;
    z-index: 1;
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.logo {
    font-size: 52px;
    margin-bottom: 12px;
    display: block;
    filter: drop-shadow(0 4px 12px rgba(99,102,241,0.5));
}

.logo-small { font-size: 28px; }

.login-header h1 {
    font-size: 22px;
    font-weight: 700;
    margin-bottom: 6px;
    color: #fff;
    letter-spacing: -0.3px;
}

.login-header p {
    color: rgba(255,255,255,0.55);
    font-size: 13px;
}

.login-box h2 {
    font-size: 17px;
    font-weight: 600;
    margin-bottom: 20px;
    color: #fff;
}

/* Inputs glass */
.login-box .form-group label {
    color: rgba(255,255,255,0.7);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    display: block;
}

.login-box .form-group input {
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: 10px !important;
    color: #fff !important;
    padding: 11px 14px !important;
    font-size: 14px !important;
    transition: border-color 0.2s, background 0.2s;
    width: 100%;
}

.login-box .form-group input::placeholder { color: rgba(255,255,255,0.35) !important; }
.login-box .form-group input:focus {
    outline: none;
    border-color: rgba(99,102,241,0.7) !important;
    background: rgba(255,255,255,0.12) !important;
    box-shadow: 0 0 0 3px rgba(99,102,241,0.2);
}

/* Botão glass primary */
.login-box .btn-primary {
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%) !important;
    border: none !important;
    border-radius: 10px !important;
    padding: 12px !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    color: #fff !important;
    width: 100%;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(99,102,241,0.4);
    transition: transform 0.15s, box-shadow 0.15s;
    margin-top: 4px;
}
.login-box .btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(99,102,241,0.5);
}
.login-box .btn-primary:active { transform: translateY(0); }

.toggle-link {
    text-align: center;
    margin-top: 20px;
    font-size: 13px;
    color: rgba(255,255,255,0.5);
}
.toggle-link a {
    color: #a5b4fc;
    font-weight: 600;
    text-decoration: none;
}
.toggle-link a:hover { color: #fff; text-decoration: underline; }

.login-hint {
    margin-top: 20px;
    padding: 12px;
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 10px;
    font-size: 12px;
    color: rgba(255,255,255,0.45);
    text-align: center;
    line-height: 1.5;
}

.login-error {
    color: #fca5a5;
    font-size: 13px;
    margin-top: 10px;
    min-height: 18px;
}

.profile-email {
    margin-top: 8px;
    font-size: 13px;
    color: #a5b4fc;
    font-weight: 600;
}

/* ===== TELA DE PERFIL ===== */
.profile-email {
    margin-top: 8px;
    font-size: 13px;
    color: var(--primary);
    font-weight: 600;
}

.profile-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 8px;
}

.profile-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 10px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 12px;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    color: #fff;
}

.profile-btn:hover {
    border-color: rgba(99,102,241,0.7);
    background: rgba(99,102,241,0.2);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(99,102,241,0.3);
}

.profile-btn:disabled {
    opacity: 0.5;
    cursor: wait;
}

.profile-btn-icon { font-size: 28px; }

.profile-btn-name {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
}

/* ===== SIDEBAR PROFILE BADGE ===== */
.sidebar-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 8px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 10px;
}

.sidebar-avatar {
    position: relative;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 2.5px solid var(--primary);
    background: var(--primary-light);
    color: var(--primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: 700;
    overflow: visible;
    padding: 0;
    flex-shrink: 0;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.12);
    transition: box-shadow 0.15s;
}

.sidebar-avatar:hover {
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.22);
}

.sidebar-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.sidebar-avatar-edit {
    position: absolute;
    bottom: -4px;
    right: -4px;
    background: var(--primary);
    color: white;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    border: 2px solid var(--surface);
}

.sidebar-profile-info {
    flex: 1;
    min-width: 0;
}

.sidebar-profile-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

.sidebar-profile-name {
    font-size: 14px;
    font-weight: 700;
    color: var(--primary);
}

/* ===== AVATAR NA NAV ===== */
.nav-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary-dark);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 700;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid transparent;
    transition: border-color 0.15s;
}

.nav-item:hover .nav-avatar {
    border-color: var(--primary);
}

.nav-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.nav-avatar-house {
    background: rgba(245, 158, 11, 0.15);
    font-size: 14px;
}

.nav-avatar-ganhos {
    background: rgba(16, 185, 129, 0.15);
    font-size: 14px;
}

.sidebar-divider {
    height: 1px;
    background: var(--border);
    margin: 10px 8px;
    opacity: 0.6;
}

.nav-item.active .nav-avatar {
    background: rgba(255,255,255,0.2);
    color: white;
}

.nav-avatar-fallback {
    line-height: 1;
}

/* ===== DIVISÃO ENTRE MORADORES ===== */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 8px 0;
    user-select: none;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
    cursor: pointer;
}

.split-options {
    margin-top: 12px;
    padding: 12px;
    background: var(--bg);
    border-radius: 8px;
}

.split-help {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.split-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.split-resident {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.1s;
}

.split-resident:hover {
    border-color: var(--primary);
}

.split-resident:has(input:checked) {
    background: var(--primary-light);
    border-color: var(--primary);
}

.split-resident input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.split-resident .self-tag {
    margin-left: auto;
    font-size: 11px;
    color: var(--text-muted);
    font-style: italic;
}

.split-preview {
    margin-top: 12px;
    padding: 10px;
    background: var(--primary-light);
    color: var(--primary-dark);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-align: center;
}

.split-preview.warning {
    background: rgba(245,158,11,0.15);
    color: #b45309;
}

/* ===== COMPROVANTES ===== */
.receipts-help {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-style: italic;
}

.receipts-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 8px;
}

.receipt-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
}

.receipt-icon {
    font-size: 18px;
    flex-shrink: 0;
}

.receipt-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
}

.receipt-name:hover {
    text-decoration: underline;
    color: var(--primary);
}

.receipt-size {
    color: var(--text-muted);
    font-size: 11px;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.receipt-delete {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 14px;
    padding: 4px;
    border-radius: 4px;
}

.receipt-delete:hover {
    color: var(--danger);
    background: rgba(239,68,68,0.1);
}

.btn-block {
    width: 100%;
}

.attach-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 3px 8px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--primary);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(79, 70, 229, 0.15);
}

.owner-display {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-weight: 600;
    color: var(--text);
    font-size: 14px;
}

/* ===== POPUP PIX ===== */
.pix-banner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(3px);
}
.pix-banner-box {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 36px 28px 28px;
    max-width: 380px;
    width: 100%;
    text-align: center;
    border-top: 4px solid #f59e0b;
}
.pix-banner-icon { font-size: 44px; margin-bottom: 12px; }
.pix-banner-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 10px;
}
.pix-banner-desc {
    font-size: 14px;
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 24px;
}
.pix-banner-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* ===== PIX ===== */
.pix-edit-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 11px;
    color: var(--primary);
    cursor: pointer;
    padding: 2px 8px;
    margin-top: 4px;
    transition: background 0.15s;
    display: inline-flex;
    align-items: center;
    gap: 3px;
}
.pix-edit-btn:hover { background: var(--primary-light); }
.pix-key-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 16px;
    margin: 12px 0 0;
    text-align: left;
}
.pix-key-label { font-size: 12px; color: var(--text-muted); margin-bottom: 4px; }
.pix-key-type { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 4px; }
.pix-key-value {
    font-size: 15px;
    font-weight: 700;
    color: var(--text);
    word-break: break-all;
    margin-bottom: 10px;
}
.pix-copy-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 14px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.15s;
}
.pix-copy-btn:hover { background: var(--primary-dark); }
.pix-no-key {
    font-size: 13px;
    color: var(--text-muted);
    background: var(--bg);
    border-radius: 10px;
    padding: 12px 16px;
    margin-top: 12px;
    border: 1px dashed var(--border);
}

/* ===== POPUP FIM DE MÊS ===== */
.endmonth-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(2px);
}
.endmonth-box {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 32px 28px 24px;
    max-width: 400px;
    width: 100%;
    text-align: center;
    border-top: 4px solid var(--warning);
}
.endmonth-icon { font-size: 40px; margin-bottom: 12px; }
.endmonth-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 8px;
}
.endmonth-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 14px;
}
.endmonth-list {
    list-style: none;
    text-align: left;
    background: var(--bg);
    border-radius: 10px;
    padding: 10px 14px;
    margin-bottom: 14px;
    max-height: 200px;
    overflow-y: auto;
}
.endmonth-list li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    color: var(--text);
    gap: 8px;
}
.endmonth-list li:last-child { border-bottom: none; }
.endmonth-list li span { color: var(--danger); font-weight: 600; white-space: nowrap; }
.endmonth-total {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 20px;
}
.endmonth-total strong { color: var(--danger); font-size: 16px; }
.endmonth-actions { display: flex; gap: 10px; justify-content: center; }

/* ===== NOTIFICAÇÕES ===== */
.notif-wrap {
    position: relative;
}
.notif-btn {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    padding: 4px 6px;
    border-radius: 8px;
    position: relative;
    line-height: 1;
    transition: background 0.15s;
}
.notif-btn:hover { background: rgba(0,0,0,0.06); }
.notif-badge {
    position: absolute;
    top: 0px;
    right: 0px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 3px;
    pointer-events: none;
}
.notif-panel {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 340px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 18px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.08);
    z-index: 200;
    overflow: hidden;
    animation: dropdown-in 0.18s ease;
}
.notif-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    font-weight: 700;
    font-size: 13px;
    letter-spacing: 0.2px;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: #fff;
}
.notif-close {
    background: rgba(255,255,255,0.18);
    border: none;
    cursor: pointer;
    font-size: 12px;
    color: #fff;
    padding: 3px 8px;
    border-radius: 6px;
    font-family: inherit;
    transition: background 0.15s;
}
.notif-close:hover { background: rgba(255,255,255,0.3); }
.notif-list {
    list-style: none;
    max-height: 180px;
    overflow-y: auto;
}
.notif-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 18px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    transition: background 0.12s;
}
.notif-item:hover { background: var(--bg); }
.notif-item:last-child { border-bottom: none; }
.notif-item-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--danger);
    flex-shrink: 0;
    margin-top: 4px;
}
.notif-item-body { flex: 1; min-width: 0; }
.notif-item-desc {
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.notif-item-meta {
    color: var(--text-muted);
    font-size: 11px;
    margin-top: 1px;
}
.notif-item-value {
    color: var(--danger);
    font-weight: 700;
    font-size: 12px;
    flex-shrink: 0;
    white-space: nowrap;
}
.notif-empty {
    padding: 16px 18px;
    text-align: center;
    color: var(--success);
    font-size: 13px;
    font-weight: 500;
}

/* ---- Lembretes ---- */
.notif-reminders-section {
    border-top: 1px solid var(--border);
}
.notif-reminders-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 18px 6px;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}
.reminder-add-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 20px;
    padding: 3px 12px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.reminder-add-btn:hover { background: var(--primary-dark); }
.reminder-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 160px;
    overflow-y: auto;
}
.reminder-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 18px;
    border-bottom: 1px solid var(--border);
    transition: background 0.12s;
}
.reminder-item:hover { background: var(--bg); }
.reminder-item:last-child { border-bottom: none; }
.reminder-item-info { flex: 1; min-width: 0; }
.reminder-item-title {
    font-weight: 600;
    color: var(--text);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.reminder-item-date {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 1px;
}
.reminder-item-date.urgent { color: var(--danger); font-weight: 700; }
.reminder-item-delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 13px;
    padding: 3px 6px;
    border-radius: 6px;
    flex-shrink: 0;
    transition: background 0.12s, color 0.12s;
}
.reminder-item-delete:hover { background: #fee2e2; color: var(--danger); }

/* Formulário inline */
.reminder-form {
    padding: 12px 18px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: var(--bg);
    border-top: 1px solid var(--border);
}
.reminder-form input[type="text"],
.reminder-form input[type="date"] {
    width: 100%;
    padding: 8px 12px;
    border: 1.5px solid var(--border);
    border-radius: 9px;
    font-size: 13px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: border-color 0.15s;
    box-sizing: border-box;
}
.reminder-form input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
.reminder-form-actions {
    display: flex;
    gap: 8px;
}
.reminder-form-actions .btn-secondary,
.reminder-form-actions .btn-primary {
    flex: 1;
    padding: 7px 0;
    font-size: 13px;
    border-radius: 9px;
}

.share-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 3px 9px;
    background: rgba(245, 158, 11, 0.12);
    color: var(--warning);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid rgba(245, 158, 11, 0.2);
}

.row-share {
    background: rgba(245, 158, 11, 0.04);
}

.row-share:hover {
    background: rgba(245, 158, 11, 0.08) !important;
}

/* ===== CHECKBOX "PAGO" ===== */
.paid-check {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border: 1.5px solid var(--border);
    border-radius: 999px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--surface);
    transition: all 0.18s ease;
    user-select: none;
}

.paid-check:hover {
    border-color: var(--success);
    color: var(--success);
    background: rgba(16, 185, 129, 0.06);
}

.paid-check input[type="checkbox"] {
    margin: 0;
    accent-color: var(--success);
    cursor: pointer;
}

.paid-check input[type="checkbox"]:checked + .paid-label {
    color: var(--success);
}

.paid-check:has(input:checked) {
    background: rgba(16, 185, 129, 0.1);
    border-color: var(--success);
    color: var(--success);
}

/* Linha marcada como paga */
.row-paid {
    background: rgba(16, 185, 129, 0.05) !important;
}

.row-paid:hover {
    background: rgba(16, 185, 129, 0.1) !important;
}

.row-paid .expense-value {
    color: var(--success);
    text-decoration: line-through;
}

.row-paid .share-tag {
    opacity: 0.6;
}

/* Status só leitura (na aba de outro morador) */
.paid-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 700;
    cursor: default;
    user-select: none;
    letter-spacing: 0.1px;
}

.paid-status.paid {
    background: rgba(16, 185, 129, 0.14);
    color: var(--success);
    border: 1px solid rgba(16, 185, 129, 0.22);
}

.paid-status.unpaid {
    background: var(--bg);
    color: var(--text-muted);
    border: 1px dashed var(--border);
}

/* Badge "X/4 pagos" na aba Casa */
.paid-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 8px;
    padding: 3px 9px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

/* ===== ROW READ-ONLY BADGE ===== */
.row-readonly {
    display: inline-flex;
    align-items: center;
    justify-content: flex-end;
    width: 100%;
    color: var(--text-muted);
    font-size: 14px;
    opacity: 0.5;
}

/* ===== FORMS ===== */
.form-group {
    margin-bottom: 18px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    margin-bottom: 7px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
    background: var(--bg);
    color: var(--text);
}

.form-group input:hover,
.form-group select:hover {
    border-color: var(--text-muted);
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--surface);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.12);
}

/* ===== BUTTONS ===== */
.btn-primary,
.btn-secondary,
.btn-danger {
    padding: 10px 20px;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: all 0.18s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    width: 100%;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.4);
    filter: brightness(1.08);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 8px rgba(79, 70, 229, 0.25);
}

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

.btn-secondary:hover {
    background: var(--bg);
    border-color: var(--text-muted);
    transform: translateY(-1px);
    box-shadow: var(--shadow-sm);
}

.btn-secondary:active {
    transform: translateY(0);
}

.btn-danger {
    background: var(--surface);
    color: var(--danger);
    border: 1px solid var(--border);
}

.btn-danger:hover {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
    transform: translateY(-1px);
}

.btn-danger:active {
    transform: translateY(0);
}

/* In modal/header, primary button should be auto width */
.modal-actions .btn-primary,
.tab-header .btn-primary {
    width: auto;
}

/* ===== APP SHELL (header + sidebar + main) ===== */
.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.app-header {
    background: var(--surface);
    padding: 0 28px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 1px 0 var(--border), 0 4px 16px rgba(0,0,0,0.04);
}

body.dark .app-header {
    background: rgba(30, 41, 59, 0.85);
    box-shadow: 0 1px 0 var(--border), 0 4px 24px rgba(0,0,0,0.3);
}

.icon-btn-large {
    background: transparent;
    border: none;
    font-size: 22px;
    cursor: pointer;
    padding: 6px 10px;
    border-radius: 6px;
    color: var(--text);
    line-height: 1;
}

.icon-btn-large:hover {
    background: var(--bg);
}

.app-body {
    display: grid;
    grid-template-columns: 240px 1fr;
    align-items: start;
}

.app-main {
    padding: 24px 28px 48px;
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.app-header-logo {
    height: 28px;
    width: auto;
    display: block;
}
.logo-dark { display: none; }
body.dark .logo-light { display: none; }
body.dark .logo-dark { display: block; }

.header-left h1 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.4px;
    background: linear-gradient(135deg, var(--primary) 0%, #8b5cf6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.month-picker-btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    transition: all 0.18s ease;
}

.month-picker-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.08);
}

.month-icon {
    font-size: 15px;
}

.month-text {
    text-transform: capitalize;
}

.month-caret {
    color: var(--text-muted);
    font-size: 11px;
    margin-left: 2px;
}

.month-picker-wrap {
    position: relative;
    display: inline-block;
}

.month-picker-popup {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 280px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 14px;
    z-index: 200;
    animation: mp-fade 0.15s ease-out;
}

@keyframes mp-fade {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

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

.mp-year {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    flex: 1;
    text-align: center;
}

.mp-nav {
    background: var(--bg);
    border: none;
    cursor: pointer;
    padding: 4px 12px;
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 18px;
    font-weight: 700;
    line-height: 1;
    transition: all 0.1s;
    font-family: inherit;
}

.mp-nav:hover {
    background: var(--primary-light);
    color: var(--primary);
}

.mp-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
}

.mp-month {
    padding: 10px 6px;
    border: 1.5px solid transparent;
    background: transparent;
    border-radius: 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    transition: all 0.1s;
    text-transform: capitalize;
}

.mp-month:hover {
    background: var(--primary-light);
    color: var(--primary-dark);
}

.mp-month.current {
    border-color: var(--primary);
    color: var(--primary);
}

.mp-month.selected {
    background: var(--primary);
    color: white;
}

.mp-month.selected:hover {
    background: var(--primary-dark);
    color: white;
}

.mp-footer {
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    display: flex;
    justify-content: flex-end;
}

.mp-action {
    background: transparent;
    border: none;
    cursor: pointer;
    color: var(--primary);
    font-weight: 600;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 6px;
    font-family: inherit;
}

.mp-action:hover {
    background: var(--primary-light);
}

.user-info { display: none; }

/* ===== HEADER PROFILE DROPDOWN ===== */
.header-profile-wrap { position: relative; }

.header-profile-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--primary-light);
    cursor: pointer;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    padding: 0;
    transition: border-color 0.18s, box-shadow 0.18s, transform 0.18s;
}
.header-profile-btn:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.18);
    transform: scale(1.06);
}
.header-profile-btn img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.header-profile-menu {
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 260px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 16px 48px rgba(0,0,0,0.16), 0 4px 12px rgba(0,0,0,0.08);
    z-index: 300;
    overflow: hidden;
    animation: dropdown-in 0.18s ease;
}
.hpm-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
}
.hpm-avatar-wrap {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--primary-light);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid var(--border);
    cursor: pointer;
    position: relative;
    padding: 0;
    transition: border-color 0.15s;
}
.hpm-avatar-wrap:hover { border-color: var(--primary); }
.hpm-avatar-wrap img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.hpm-avatar-edit {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    opacity: 0;
    transition: opacity 0.15s;
    border-radius: 50%;
}
.hpm-avatar-wrap:hover .hpm-avatar-edit { opacity: 1; }
.hpm-info { min-width: 0; }
.hpm-name {
    font-weight: 700;
    font-size: 14px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hpm-email {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.hpm-divider {
    height: 1px;
    background: var(--border);
    margin: 0;
}
.hpm-item {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-align: left;
    transition: background 0.12s;
}
.hpm-item:hover { background: var(--bg); }
.hpm-logout { color: var(--danger); }
.hpm-logout:hover { background: rgba(239,68,68,0.07); }
.hpm-invite-header {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.hpm-invite-link-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0 16px 8px;
}
.hpm-invite-input {
    flex: 1;
    font-size: 11px;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    min-width: 0;
}
.hpm-copy-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 6px 8px;
    cursor: pointer;
    font-size: 13px;
    flex-shrink: 0;
    transition: background 0.15s;
}
.hpm-copy-btn:hover { background: var(--primary-dark); }

/* ===== SIDEBAR ===== */
.sidebar {
    background: var(--surface);
    border-right: 1px solid var(--border);
    padding: 16px 10px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    transition: transform 0.25s ease;
    position: sticky;
    top: 64px;
    align-self: start;
    height: calc(100vh - 64px);
    overflow-y: auto;
    box-shadow: 1px 0 0 var(--border);
}

.sidebar-header {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    padding: 4px 12px 10px;
    opacity: 0.7;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    display: grid;
    grid-template-columns: 28px 1fr auto;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13.5px;
    font-weight: 500;
    font-family: inherit;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.18s ease;
    text-align: left;
    width: 100%;
    position: relative;
}

.nav-item:hover {
    background: var(--bg);
    color: var(--text);
    transform: translateX(1px);
}

.nav-item.active {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.35);
    transform: none;
}

.nav-item-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.nav-item-disabled:hover {
    background: transparent;
}

.nav-item.active .nav-value {
    color: rgba(255,255,255,0.85);
}

.nav-icon {
    font-size: 16px;
}

.nav-label {
    font-weight: 600;
    font-size: 13.5px;
}

.nav-value {
    font-size: 11.5px;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

.nav-item.active .nav-value {
    color: rgba(255,255,255,0.75);
}

.sidebar-total {
    margin-top: auto;
    padding: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    color: white;
    border-radius: 14px;
    box-shadow: 0 6px 20px rgba(79, 70, 229, 0.4), inset 0 1px 0 rgba(255,255,255,0.15);
    position: relative;
    overflow: hidden;
}

.sidebar-total::before {
    content: '';
    position: absolute;
    top: -20px;
    right: -20px;
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.08);
    border-radius: 50%;
    pointer-events: none;
}

.sidebar-total-label {
    font-size: 11px;
    opacity: 0.8;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-weight: 600;
}

.sidebar-total-value {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 90;
}

.sidebar-overlay.active {
    display: block;
}

/* ===== SALDO DO BANCO ===== */
.bank-balance-section {
    margin-bottom: 20px;
}

.bank-balance-card {
    background: linear-gradient(135deg, #059669 0%, #10b981 50%, #34d399 100%);
    color: white;
    border-radius: 18px;
    padding: 22px 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    box-shadow: 0 8px 28px rgba(16, 185, 129, 0.35), inset 0 1px 0 rgba(255,255,255,0.2);
    flex-wrap: wrap;
    position: relative;
    overflow: hidden;
}

.bank-balance-card::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 130px;
    height: 130px;
    background: rgba(255,255,255,0.1);
    border-radius: 50%;
    pointer-events: none;
}

.bank-balance-card::after {
    content: '';
    position: absolute;
    bottom: -40px;
    left: 40%;
    width: 100px;
    height: 100px;
    background: rgba(255,255,255,0.06);
    border-radius: 50%;
    pointer-events: none;
}

.month-summary-grid {
    display: flex;
    align-items: center;
    gap: 0;
    width: 100%;
    flex-wrap: wrap;
}

.month-summary-item {
    flex: 1;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 0 20px;
}

.month-summary-item:first-child {
    padding-left: 0;
}

.month-summary-item:last-child {
    padding-right: 0;
}

.month-summary-divider {
    width: 1px;
    height: 48px;
    background: rgba(255, 255, 255, 0.3);
    flex-shrink: 0;
}

.month-summary-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    opacity: 0.85;
}

.month-summary-value {
    font-size: 24px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
    line-height: 1.1;
}

.month-summary-balance {
    font-size: 28px;
}

.month-summary-balance.negative {
    color: #fca5a5;
}

/* ===== CHARTS ===== */
.charts-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 22px;
}

/* ===== LAYOUT GRÁFICOS ===== */
.charts-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 18px;
    margin-bottom: 22px;
    align-items: stretch;
}

/* Ambos os cards têm a mesma altura fixa */
.charts-layout > .chart-card,
.chart-carousel-card {
    height: 400px;
    display: flex;
    flex-direction: column;
}

.charts-layout > .chart-card .chart-wrap {
    flex: 1;
    height: auto;
}

.carousel-slide { display: none; }
.carousel-slide.active {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
}

.chart-carousel-card .chart-wrap {
    flex: 1;
    height: auto;
    min-height: 0;
}

/* Slide "O que devo" — layout donut + legenda */
.owe-chart-layout {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 16px;
    padding: 8px 0 4px;
}

.owe-donut-wrap {
    flex: 1;
    min-height: 0;
    position: relative;
}

.owe-legend {
    list-style: none;
    padding: 0 4px;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}

.owe-legend-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
}

.owe-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.owe-legend-name {
    flex: 1;
    color: var(--text);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.owe-legend-pct {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 600;
    min-width: 32px;
    text-align: right;
}

.owe-legend-val {
    color: #f87171;
    font-weight: 700;
    font-size: 13px;
    min-width: 80px;
    text-align: right;
}

.chart-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
}

.carousel-arrow-inline {
    background: none;
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    line-height: 1;
}
.carousel-arrow-inline:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
.carousel-arrow-inline:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.carousel-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 12px;
}
.carousel-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s, transform 0.2s;
    cursor: pointer;
    border: none;
    padding: 0;
}
.carousel-dot.active {
    background: var(--primary);
    transform: scale(1.4);
}

.chart-slide-indicator {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
    white-space: nowrap;
}

.chart-card {
    background: var(--surface);
    border-radius: 16px;
    padding: 22px 22px 18px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: box-shadow 0.2s, transform 0.2s;
}

.chart-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}

.chart-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
    letter-spacing: -0.2px;
}

.chart-card .chart-title {
    padding-bottom: 4px;
    margin-bottom: 2px;
}

.chart-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 14px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--border);
}

.receive-status-bar {
    padding: 0 0 10px;
    flex-shrink: 0;
}

.receive-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.receive-status-badge.pending {
    background: rgba(245,158,11,0.12);
    color: var(--warning);
    border: 1px solid rgba(245,158,11,0.25);
}

.receive-status-badge.done {
    background: rgba(16,185,129,0.1);
    color: var(--success);
    border: 1px solid rgba(16,185,129,0.2);
}

.chart-wrap {
    position: relative;
    height: 260px;
}

.chart-empty {
    position: absolute;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 13px;
    background: var(--bg);
    border-radius: 8px;
}

.chart-empty.active {
    display: flex;
}


/* ===== TAB CONTENT ===== */
.tab-content {
    background: var(--surface);
    border-radius: 16px;
    padding: 26px;
    box-shadow: var(--shadow);
    margin-bottom: 20px;
    border: 1px solid var(--border);
}

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

.tab-header h2 {
    font-size: 19px;
    font-weight: 700;
    letter-spacing: -0.4px;
    color: var(--text);
}

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

.category-filter {
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--surface);
    font-family: inherit;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: border-color 0.15s;
    max-width: 220px;
}

.category-filter:hover {
    border-color: var(--primary);
}

.category-filter:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}

/* ===== TABLE ===== */
.expense-list-container {
    overflow-x: auto;
    border-radius: 10px;
}

.expense-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.expense-table th,
.expense-table td {
    text-align: left;
    padding: 14px 14px;
    border-bottom: 1px solid var(--border);
}

.expense-table th {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding-top: 0;
    padding-bottom: 12px;
}

.expense-table tbody tr {
    transition: background 0.12s ease;
}

.expense-table tbody tr:hover {
    background: var(--bg);
}

.expense-table tbody tr:last-child td {
    border-bottom: none;
}

.expense-table tfoot td {
    border-top: 2px solid var(--border);
    border-bottom: none;
    padding-top: 16px;
    font-size: 15px;
    font-weight: 700;
}

.text-right {
    text-align: right !important;
}

.expense-value {
    font-weight: 600;
    color: var(--danger);
    font-variant-numeric: tabular-nums;
}

.income-value {
    font-weight: 600;
    color: var(--success);
    font-variant-numeric: tabular-nums;
}

.source-badge {
    display: inline-block;
    padding: 4px 11px;
    background: rgba(16, 185, 129, 0.12);
    color: var(--success);
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    border: 1px solid rgba(16, 185, 129, 0.2);
}

.category-badge {
    display: inline-block;
    padding: 4px 11px;
    background: rgba(79, 70, 229, 0.12);
    color: var(--primary);
    border-radius: 999px;
    font-size: 11.5px;
    font-weight: 600;
    letter-spacing: 0.1px;
    border: 1px solid rgba(79, 70, 229, 0.18);
    transition: background 0.15s;
}

body.dark .category-badge {
    background: rgba(129, 140, 248, 0.15);
    color: var(--primary);
    border-color: rgba(129, 140, 248, 0.25);
}

.row-actions {
    display: flex;
    gap: 6px;
    justify-content: flex-end;
    align-items: center;
    position: relative;
    min-width: 120px;
}

/* Garante que paid-status sozinho fique alinhado à direita */
.expense-table td:last-child {
    text-align: right;
    white-space: nowrap;
    width: 140px;
}

.row-menu-btn {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    font-weight: 700;
    padding: 3px 10px;
    color: var(--text-muted);
    transition: all 0.15s ease;
    line-height: 1.4;
    letter-spacing: 1px;
}
.row-menu-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.05);
}

.row-dropdown {
    position: absolute;
    right: 0;
    top: calc(100% + 4px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    box-shadow: 0 12px 32px rgba(0,0,0,0.15), 0 2px 8px rgba(0,0,0,0.08);
    z-index: 100;
    min-width: 160px;
    overflow: hidden;
    display: none;
    animation: dropdown-in 0.15s ease;
}
.row-dropdown.open { display: block; }

@keyframes dropdown-in {
    from { opacity: 0; transform: translateY(-4px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.row-dropdown-item {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 11px 16px;
    background: none;
    border: none;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    text-align: left;
    transition: background 0.12s;
    white-space: nowrap;
}
.row-dropdown-item:hover { background: var(--bg); }
.row-dropdown-item.danger { color: var(--danger); }
.row-dropdown-item.danger:hover { background: rgba(239,68,68,0.08); }
.row-dropdown-item.success { color: var(--success); }
.row-dropdown-item.success:hover { background: rgba(16, 185, 129, 0.08); }

.icon-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 16px;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.1s;
}

.icon-btn:hover {
    background: var(--border);
}

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

.empty-state p {
    margin-bottom: 8px;
    font-size: 14px;
}

/* ===== FOOTER ===== */
.app-footer {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    padding: 20px 0;
}

/* ===== MODAL ===== */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    animation: modal-backdrop-in 0.2s ease;
}

@keyframes modal-backdrop-in {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background: var(--surface);
    border-radius: 18px;
    padding: 28px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 24px 64px rgba(0,0,0,0.25), 0 4px 16px rgba(0,0,0,0.1);
    border: 1px solid var(--border);
    animation: modal-slide-in 0.22s ease;
}

@keyframes modal-slide-in {
    from { opacity: 0; transform: translateY(12px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Modal expense redesign */
.expense-modal-content {
    padding: 0 !important;
    overflow-y: auto;
    max-width: 480px;
}

.expense-modal-content .modal-header {
    background: linear-gradient(135deg, var(--primary) 0%, #7c3aed 100%);
    padding: 18px 20px 16px;
    margin-bottom: 0;
    border-bottom: none;
    border-radius: 18px 18px 0 0;
}

.modal-header-inner {
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header-icon {
    font-size: 20px;
    line-height: 1;
}

.expense-modal-content .modal-header h2 {
    color: #fff;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.2px;
}

.expense-modal-content .modal-close {
    background: rgba(255,255,255,0.18);
    border: none;
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    padding: 5px 10px;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s;
}
.expense-modal-content .modal-close:hover { background: rgba(255,255,255,0.3); }

/* Owner bar */
.expense-owner-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 20px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
}
.expense-owner-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    flex-shrink: 0;
}
.expense-owner-bar .owner-display {
    display: flex;
    align-items: center;
    gap: 7px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

/* Form body */
.expense-form-body {
    padding: 16px 20px 4px;
    display: flex;
    flex-direction: column;
}
.expense-form-body .form-group {
    margin-bottom: 14px;
}

/* Options section */
.expense-options-section {
    padding: 0 20px 8px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.expense-options-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin-bottom: 2px;
}

/* Option cards */
.expense-option-card {
    border: 1.5px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    transition: border-color 0.15s;
    margin: 0 20px 8px;
}
.expense-option-card:has(.option-checkbox:checked) {
    border-color: var(--primary);
    background: rgba(79,70,229,0.03);
}
.expense-options-section .expense-option-card {
    margin: 0;
}

.option-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    cursor: pointer;
    gap: 10px;
    user-select: none;
}
.option-toggle-row:hover { background: var(--bg); }

.option-toggle-info {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0;
}
.option-toggle-icon {
    font-size: 18px;
    flex-shrink: 0;
    width: 28px;
    text-align: center;
}
.option-toggle-info strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}
.option-toggle-info p {
    font-size: 11px;
    color: var(--text-muted);
    margin: 0;
    line-height: 1.3;
}

/* Toggle switch */
.option-checkbox {
    appearance: none;
    -webkit-appearance: none;
    width: 38px;
    height: 22px;
    background: var(--border);
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
}
.option-checkbox::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.2s;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.option-checkbox:checked {
    background: var(--primary);
}
.option-checkbox:checked::after {
    transform: translateX(16px);
}

/* Option body (expanded) */
.option-body {
    padding: 10px 14px 12px;
    border-top: 1px solid var(--border);
    background: var(--bg);
}
.option-sub-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}
.recurring-day-input {
    width: 80px;
    padding: 7px 10px;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    text-align: center;
}
.recurring-day-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Modal header (default — non-expense modals) */
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.modal-close {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 20px;
    cursor: pointer;
    color: var(--text-muted);
    line-height: 1;
    padding: 2px 10px;
    transition: all 0.15s;
}
.modal-close:hover {
    color: var(--text);
    background: var(--border);
    border-color: var(--text-muted);
}

.modal-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    margin-top: 0;
    padding: 14px 20px 18px;
    border-top: 1px solid var(--border);
}
.expense-modal-content .modal-actions .btn-primary { min-width: 120px; }
.expense-modal-content .modal-actions .btn-secondary { min-width: 90px; }

/* ===== TOAST ===== */
.toast {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: #1e293b;
    color: white;
    padding: 13px 22px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0,0,0,0.25), 0 2px 8px rgba(0,0,0,0.15);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    z-index: 2000;
    pointer-events: none;
    border: 1px solid rgba(255,255,255,0.1);
    backdrop-filter: blur(8px);
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

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

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

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255,255,255,0.65);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
}

body.dark .loading-overlay {
    background: rgba(15, 23, 42, 0.65);
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    box-shadow: 0 0 0 1px rgba(79,70,229,0.1);
}

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

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 980px) {
    .charts-section {
        grid-template-columns: 1fr;
    }

    .chart-wrap {
        height: 240px;
    }

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

    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        width: 260px;
        height: 100vh;
        z-index: 110;
        transform: translateX(-100%);
        box-shadow: var(--shadow-lg);
    }

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

    .app-main {
        padding: 16px;
    }
}

@media (max-width: 640px) {
    .app-header {
        padding: 10px 14px;
    }

    .header-left h1 {
        font-size: 17px;
    }

    .header-right {
        width: 100%;
        justify-content: space-between;
    }

    .tab-content,
    .chart-card,
    .quick-add {
        padding: 16px;
    }

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

    .expense-table th:nth-child(3),
    .expense-table td:nth-child(3) {
        display: none;
    }

    .login-box {
        padding: 28px 22px;
    }

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

/* No desktop esconde o botão de menu (sidebar sempre visível) */
@media (min-width: 981px) {
    #sidebar-toggle {
        display: none;
    }
}

/* ===== ONBOARDING MULTI-CASA ===== */
.onboarding-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    position: relative;
    overflow: hidden;
}
.onboarding-screen::before {
    content: '';
    position: absolute;
    width: 500px; height: 500px;
    background: radial-gradient(circle, #6366f1, #8b5cf6);
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.3;
    top: -150px; left: -150px;
    pointer-events: none;
}
.onboarding-screen::after {
    content: '';
    position: absolute;
    width: 400px; height: 400px;
    background: radial-gradient(circle, #ec4899, #f43f5e);
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.25;
    bottom: -120px; right: -120px;
    pointer-events: none;
}

.onboarding-box {
    background: rgba(255,255,255,0.07);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 24px;
    box-shadow: 0 8px 32px rgba(0,0,0,0.4), inset 0 1px 0 rgba(255,255,255,0.1);
    padding: 40px;
    width: 100%;
    max-width: 480px;
    position: relative;
    z-index: 1;
    color: #fff;
}
.onboarding-box h3, .onboarding-box h4 { color: #fff; }
.onboarding-box p, .onboarding-box label { color: rgba(255,255,255,0.7); }
.onboarding-box .form-group input,
.onboarding-box .form-group select {
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: 10px !important;
    color: #fff !important;
}
.onboarding-box .form-group input::placeholder { color: rgba(255,255,255,0.35) !important; }
.onboarding-box .form-group input:focus,
.onboarding-box .form-group select:focus {
    outline: none;
    border-color: rgba(99,102,241,0.7) !important;
    background: rgba(255,255,255,0.12) !important;
}
.onboarding-box .toggle-link { color: rgba(255,255,255,0.5); }
.onboarding-box .toggle-link a { color: #a5b4fc; }
.onboarding-box .login-error { color: #fca5a5; }

.onboarding-box .confirm-summary {
    background: rgba(255,255,255,0.08) !important;
    border: 1px solid rgba(255,255,255,0.15) !important;
    border-radius: 12px;
    padding: 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    color: #fff;
}

.onboarding-box .confirm-row {
    display: flex;
    align-items: baseline;
    gap: 10px;
    color: rgba(255,255,255,0.9);
    font-size: 14px;
}

.onboarding-box .confirm-row span {
    color: rgba(255,255,255,0.5);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    min-width: 70px;
    flex-shrink: 0;
}

.onboarding-box .confirm-row strong {
    color: #fff;
    font-weight: 600;
}

.confirm-residents {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0;
    padding: 0;
}

.confirm-residents li {
    background: rgba(99,102,241,0.3);
    border: 1px solid rgba(99,102,241,0.5);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 13px;
    color: #c7d2fe;
}

/* Cards de modo (shared / personal) */
.mode-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
    margin: 8px 0 16px;
}

.mode-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
    text-align: center;
    font-size: 14px;
    color: var(--text);
}

.mode-card:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
    transform: translateY(-2px);
}

.mode-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Bolinhas de progresso */
.step-indicator {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin-bottom: 24px;
}

.step-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s, transform 0.2s;
    display: inline-block;
}

.step-dot.active {
    background: var(--primary);
    transform: scale(1.2);
}

.step-dot.done {
    background: var(--success);
}

/* Grid de inputs de moradores */
.residents-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin: 16px 0 4px;
}

.resident-name-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--text);
    font-size: 14px;
    transition: border-color 0.15s;
}

.resident-name-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

/* Botões de quantidade de moradores */
.residents-count-btns {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.count-btn {
    padding: 8px 18px;
    border: 2px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    color: var(--text);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.count-btn:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

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

/* Resumo de confirmação */
.confirm-summary {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 4px;
}

.confirm-row {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}

.confirm-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.confirm-row > span:first-child {
    color: var(--text-muted);
    min-width: 80px;
    flex-shrink: 0;
}

.confirm-residents {
    margin: 0;
    padding-left: 16px;
}

.confirm-residents li {
    margin-bottom: 2px;
}

/* Caixa do link de convite */
.invite-box {
    display: flex;
    gap: 8px;
    align-items: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
}

.invite-link {
    flex: 1;
    border: none;
    background: transparent;
    color: var(--text);
    font-size: 13px;
    font-family: monospace;
    outline: none;
    min-width: 0;
}

/* Responsivo onboarding */
@media (max-width: 520px) {
    .onboarding-box {
        padding: 28px 18px;
    }

    .mode-cards {
        grid-template-columns: 1fr;
    }

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

/* ===== REMINDER ALERT POPUP ===== */
.reminder-alert-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 20px;
    backdrop-filter: blur(4px);
    animation: modal-backdrop-in 0.2s ease;
}

.reminder-alert-box {
    background: var(--surface);
    border-radius: 18px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 24px 64px rgba(0,0,0,0.3);
    overflow: hidden;
    animation: modal-slide-in 0.22s ease;
}

.reminder-alert-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: linear-gradient(135deg, #f59e0b 0%, #ef4444 100%);
    color: #fff;
    font-weight: 700;
    font-size: 14px;
}

.reminder-alert-close {
    background: rgba(255,255,255,0.2);
    border: none;
    color: #fff;
    border-radius: 6px;
    padding: 3px 8px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
}
.reminder-alert-close:hover { background: rgba(255,255,255,0.35); }

.reminder-alert-body {
    padding: 12px 18px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.reminder-alert-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg);
    border: 1.5px solid var(--border);
}
.reminder-alert-item.today {
    border-color: #ef4444;
    background: rgba(239,68,68,0.06);
}

.reminder-alert-item-icon { font-size: 20px; flex-shrink: 0; }

.reminder-alert-item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.reminder-alert-item-info strong {
    font-size: 13px;
    color: var(--text);
}
.reminder-alert-item-info span {
    font-size: 12px;
    color: var(--danger);
    font-weight: 600;
}

.reminder-alert-btn {
    display: block;
    width: calc(100% - 36px);
    margin: 4px 18px 16px;
    padding: 10px;
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: background 0.15s;
}
.reminder-alert-btn:hover { background: var(--primary-dark); }

/* ============================================================
   RESPONSIVIDADE — TABLET (≤ 768px)
   ============================================================ */
@media (max-width: 768px) {
    /* Header */
    .app-header { padding: 0 14px; gap: 10px; }
    .header-left h1 { font-size: 16px; }

    /* Charts: 1 coluna */
    .charts-layout {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .charts-layout > .chart-card,
    .chart-carousel-card { height: 320px; }

    /* Card resumo do mês */
    .bank-balance-card { padding: 16px 18px; }
    .month-summary-grid { gap: 0; }
    .month-summary-item { padding: 0 12px; }
    .month-summary-value { font-size: 20px; }
    .month-summary-balance { font-size: 22px; }

    /* Tabela de gastos: oculta coluna categoria */
    .expense-table th:nth-child(3),
    .expense-table td:nth-child(3) { display: none; }

    /* Tab header */
    .tab-header { flex-wrap: wrap; gap: 8px; }
    .tab-actions { flex-wrap: wrap; gap: 8px; }
    .category-filter { min-width: 0; flex: 1; }

    /* Modal full-width */
    .modal { padding: 12px; align-items: flex-end; }
    .modal-content {
        max-width: 100%;
        max-height: 92vh;
        border-radius: 18px 18px 12px 12px;
    }
    .expense-modal-content { max-width: 100%; }

    /* Notif panel */
    .notif-panel { width: 300px; }

    /* Sidebar total */
    .sidebar-total-value { font-size: 22px; }
}

/* ===== BARRAS MOBILE ===== */
.mobile-topbar { display: none; }
.bottom-nav { display: none; }

/* Navegação por seções no mobile */
@media (max-width: 768px) {
    /* Casa: gráficos + gastos da casa */
    body[data-mobile-section="casa"] #bank-balance-section,
    body[data-mobile-section="casa"] #incomes-section,
    body[data-mobile-section="casa"] .app-footer { display: none !important; }

    /* Meus Gastos: resumo + gastos pessoais */
    body[data-mobile-section="gastos"] #charts-section,
    body[data-mobile-section="gastos"] #incomes-section,
    body[data-mobile-section="gastos"] .app-footer { display: none !important; }

    /* Ganhos */
    body[data-mobile-section="ganhos"] #bank-balance-section,
    body[data-mobile-section="ganhos"] #charts-section,
    body[data-mobile-section="ganhos"] #expenses-section,
    body[data-mobile-section="ganhos"] .app-footer { display: none !important; }
}

@media (max-width: 768px) {
    /* Header vira topbar mobile — esconde logo e hamburger, mantém controles */
    .app-header { display: flex !important; padding: 0 14px; height: 50px; }
    .header-left { gap: 0; }
    #sidebar-toggle { display: none; }
    .logo-light, .logo-dark { display: none !important; }
    .app-header-logo { display: none !important; }
    /* notif-wrap aparece no header mobile */
    .notif-wrap { display: flex !important; }

    /* Bottom nav */
    .bottom-nav {
        display: flex;
        position: fixed;
        bottom: 0; left: 0; right: 0;
        background: var(--surface);
        border-top: 1px solid var(--border);
        z-index: 200;
        padding: 6px 0 max(6px, env(safe-area-inset-bottom));
        box-shadow: 0 -2px 12px rgba(0,0,0,0.08);
    }
    .bottom-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        background: none;
        border: none;
        cursor: pointer;
        padding: 4px 0;
        position: relative;
        font-family: inherit;
    }
    .bottom-nav-icon { font-size: 20px; line-height: 1; }
    .bottom-nav-label {
        font-size: 10px;
        font-weight: 600;
        color: var(--text-muted);
    }
    .bottom-nav-item.active .bottom-nav-label { color: var(--primary); }

    /* Padding para não cobrir conteúdo */
    .app-main { padding-top: 62px !important; padding-bottom: 70px !important; }

    /* Sidebar oculta no mobile (gerenciada pelo header desktop) */
    .sidebar { display: none !important; }
    .app-body { grid-template-columns: 1fr !important; }
}

/* ============================================================
   RESPONSIVIDADE — MOBILE (≤ 480px)
   ============================================================ */
@media (max-width: 480px) {
    /* Header mobile: logo à esquerda + mês + ? + avatar à direita */
    .app-header { padding: 0 14px; height: 54px; gap: 8px; }
    .app-header-logo { height: 24px; }
    .logo-light, .logo-dark { height: 24px; }
    /* Esconde hamburger no mobile — sidebar não usada */
    #sidebar-toggle { display: none; }
    .month-picker-btn { font-size: 12px; padding: 5px 10px; gap: 4px; }
    .month-icon { font-size: 14px; }
    .help-btn { width: 28px; height: 28px; font-size: 13px; }
    /* Sino visível no header mobile */
    .notif-wrap { display: flex !important; }
    .header-profile-btn { width: 32px; height: 32px; }
    /* header-right alinhado à direita compacto */
    .header-right { gap: 8px; }

    /* Main com menos padding */
    .app-main { padding: 10px 10px 40px; }

    /* Card resumo — horizontal compacto no mobile */
    .bank-balance-card { padding: 12px 14px; border-radius: 14px; }
    .month-summary-grid { gap: 0; flex-wrap: nowrap; }
    .month-summary-item { padding: 0 8px; }
    .month-summary-item:first-child { padding-left: 0; }
    .month-summary-item:last-child { padding-right: 0; }
    .month-summary-label { font-size: 9px; }
    .month-summary-value { font-size: 14px; }
    .month-summary-balance { font-size: 15px; }
    .month-summary-divider { height: 36px; }

    /* Charts: 1 coluna, altura menor */
    .charts-layout {
        grid-template-columns: 1fr;
        gap: 12px;
    }
    .charts-layout > .chart-card,
    .chart-carousel-card { height: 280px; }

    /* Gráfico de barras: labels mais curtos */
    .chart-card { padding: 14px 12px; }
    .chart-card-header { padding-bottom: 8px; }

    /* Tabela */
    .expense-table { font-size: 12px; }
    .expense-table td, .expense-table th { padding: 8px 5px; }
    .share-tag { display: none; }
    .paid-badge { display: none; }

    /* Tab header */
    .tab-header { flex-direction: column; align-items: flex-start; gap: 8px; }
    .tab-actions { width: 100%; display: flex; gap: 6px; }
    .tab-actions .btn-primary { flex: 1; font-size: 13px; padding: 8px 10px; }
    .category-filter { flex: 1; min-width: 0; font-size: 12px; }

    /* Sidebar no mobile */
    .sidebar { width: 85vw; max-width: 300px; }

    /* Modal mobile: bottom sheet */
    .modal { padding: 0; align-items: flex-end; }
    .modal-content {
        max-width: 100%;
        width: 100%;
        max-height: 95vh;
        border-radius: 20px 20px 0 0;
        margin: 0;
    }
    .expense-modal-content { max-width: 100%; border-radius: 20px 20px 0 0; }
    .expense-modal-content .modal-header { border-radius: 20px 20px 0 0; }

    /* Valor e data: coluna única */
    .form-row { grid-template-columns: 1fr; }

    /* Notif panel — full width, abaixo do header */
    .notif-panel {
        position: fixed;
        top: 54px;
        left: 10px;
        right: 10px;
        width: auto;
        max-height: 70vh;
        overflow-y: auto;
        border-radius: 14px;
    }

    /* Calendário — full width, abaixo do header */
    .month-picker-popup {
        position: fixed;
        top: 54px;
        left: 10px;
        right: 10px;
        width: auto;
    }

    /* Avatar — esconde só o botão do header, mantém o menu acessível */
    .header-profile-btn { display: none; }

    /* Dropdown do perfil — sobe do bottom nav (bottom sheet) */
    .header-profile-menu {
        position: fixed;
        bottom: 65px;
        left: 10px;
        right: 10px;
        top: auto;
        width: auto;
        border-radius: 16px;
        animation: modal-slide-in 0.2s ease;
    }

    /* Sidebar total */
    .sidebar-total { padding: 12px 10px; }
    .sidebar-total-value { font-size: 20px; }

    /* Botões de ação */
    .modal-actions { padding: 12px 16px 20px; }
    .modal-actions .btn-primary,
    .modal-actions .btn-secondary { flex: 1; }
    .modal-actions { justify-content: stretch; }
}

/* ===== BOTÃO HELP ===== */
.help-btn {
    background: var(--primary);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 30px;
    height: 30px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.15s, transform 0.15s;
}
.help-btn:hover { background: var(--primary-dark); transform: scale(1.08); }

/* ===== TOOLTIP ===== */
.tooltip-trigger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 14px;
    height: 14px;
    background: var(--text-muted);
    color: #fff;
    border-radius: 50%;
    font-size: 9px;
    font-weight: 700;
    cursor: help;
    margin-left: 4px;
    position: relative;
    vertical-align: middle;
}
.tooltip-trigger::after {
    content: attr(data-tip);
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e293b;
    color: #fff;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 11px;
    font-weight: 400;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.15s;
    z-index: 999;
    max-width: 200px;
    white-space: normal;
    text-align: center;
    width: 180px;
}
.tooltip-trigger:hover::after { opacity: 1; }

/* ===== MODAL GUIA ===== */
.help-modal-content {
    padding: 0 !important;
    max-width: 540px;
    overflow: hidden;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
}
.help-modal-header {
    background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 18px 18px 0 0;
    border-bottom: none !important;
    margin-bottom: 0 !important;
    flex-shrink: 0;
    position: relative;
    overflow: hidden;
}
.help-modal-header::before {
    content: '';
    position: absolute;
    top: -30px;
    right: -30px;
    width: 120px;
    height: 120px;
    background: rgba(255,255,255,0.07);
    border-radius: 50%;
}
.help-modal-header::after {
    content: '';
    position: absolute;
    bottom: -20px;
    left: 40px;
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.05);
    border-radius: 50%;
}
.help-modal-header .modal-header-inner {
    display: flex;
    align-items: center;
    gap: 10px;
    z-index: 1;
}
.help-modal-header .modal-header-icon {
    font-size: 22px;
    line-height: 1;
}
.help-modal-header h2 {
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    letter-spacing: -0.3px;
}
.help-modal-header .modal-close {
    background: rgba(255,255,255,0.15);
    border: 1px solid rgba(255,255,255,0.2);
    color: #fff;
    border-radius: 8px;
    padding: 6px 11px;
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    z-index: 1;
    transition: background 0.15s;
}
.help-modal-header .modal-close:hover { background: rgba(255,255,255,0.28); }

.help-modal-body {
    padding: 20px 24px 24px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
    flex: 1;
}
.help-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.help-section h3 {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 6px;
}
.help-section > p {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.6;
    background: var(--bg);
    padding: 10px 12px;
    border-radius: 8px;
    border: 1px solid var(--border);
}
.help-item {
    background: var(--surface);
    border-radius: 10px;
    padding: 11px 14px;
    border: 1px solid var(--border);
    display: flex;
    gap: 10px;
    align-items: flex-start;
    transition: border-color 0.15s;
}
.help-item:hover { border-color: var(--primary); }
.help-item strong {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 3px;
}
.help-item p {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    margin: 0;
}
.help-item-icon {
    font-size: 18px;
    line-height: 1;
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border-radius: 8px;
    border: 1px solid var(--border);
}
.help-footer {
    border-top: 1px solid var(--border);
    padding-top: 14px;
    text-align: center;
}
.help-terms-link {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 13px;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.15s;
}
.help-terms-link:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-light);
}

/* ===== PROFILE BOTTOM SHEET ===== */
.profile-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 500;
    display: flex;
    align-items: flex-end;
    backdrop-filter: blur(2px);
}
.profile-sheet {
    background: var(--surface);
    width: 100%;
    border-radius: 20px 20px 0 0;
    padding: 0 0 max(16px, env(safe-area-inset-bottom));
    animation: sheet-up 0.25s ease;
}
@keyframes sheet-up {
    from { transform: translateY(100%); }
    to   { transform: translateY(0); }
}
.profile-sheet-handle {
    width: 40px; height: 4px;
    background: var(--border);
    border-radius: 2px;
    margin: 10px auto 14px;
}
.profile-sheet-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 20px 14px;
}
.profile-sheet-avatar {
    width: 52px; height: 52px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: pointer;
    overflow: hidden;
}
.profile-sheet-name { font-size: 16px; font-weight: 700; color: var(--text); }
.profile-sheet-email { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.profile-sheet-divider { height: 1px; background: var(--border); margin: 4px 0; }
.profile-sheet-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 20px;
    background: none;
    border: none;
    font-size: 15px;
    font-family: inherit;
    color: var(--text);
    cursor: pointer;
    text-align: left;
}
.profile-sheet-item:hover { background: var(--bg); }
.profile-sheet-house { color: var(--text-muted); font-size: 13px; padding-bottom: 8px; }
.profile-sheet-invite-row {
    display: flex;
    gap: 8px;
    padding: 0 20px 12px;
}
.profile-sheet-invite-input {
    flex: 1;
    padding: 8px 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 12px;
    background: var(--bg);
    color: var(--text);
}
.profile-sheet-copy-btn {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: 8px;
    padding: 8px 12px;
    cursor: pointer;
    font-size: 14px;
}
.profile-sheet-logout { color: var(--danger); }

/* ===== EDITAR NOME NA SIDEBAR ===== */
.sidebar-name-row {
    display: flex;
    align-items: center;
    gap: 4px;
    max-width: 100%;
    min-width: 0;
}
.sidebar-name-row .sidebar-profile-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    flex: 1;
    min-width: 0;
}
.edit-name-btn {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 11px;
    opacity: 0;
    padding: 0;
    transition: opacity 0.15s;
    line-height: 1;
    flex-shrink: 0;
}
.sidebar-name-row:hover .edit-name-btn { opacity: 0.7; }
.edit-name-btn:hover { opacity: 1 !important; }
.edit-name-form {
    margin-top: 6px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.edit-name-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    background: var(--bg);
    color: var(--text);
}
.edit-name-input:focus { outline: none; border-color: var(--primary); }
.edit-name-actions {
    display: flex;
    gap: 4px;
}
.edit-name-actions .btn-secondary,
.edit-name-actions .btn-primary {
    flex: 1;
    padding: 5px;
    font-size: 12px;
}
