/* ==================================
   DESIGN SYSTEM - TitheGov
=================================== */
:root {
    /* Color Palette - Light Blue Theme */
    --primary-color: #0284c7; /* Sky 600 */
    --primary-light: #38bdf8; /* Sky 400 */
    --primary-dark: #0369a1; /* Sky 700 */
    
    --bg-main: #f0f9ff; /* Sky 50 */
    --bg-card: #ffffff;
    --bg-sidebar: #0c4a6e; /* Sky 900 */
    
    --text-main: #0f172a; /* Slate 900 */
    --text-muted: #64748b; /* Slate 500 */
    --text-light: #f8fafc; /* Slate 50 */
    
    --border-color: #e2e8f0;
    --error-color: #ef4444;
    --success-color: #10b981;
    
    --font-fam: 'Inter', sans-serif;
    
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-glass: 0 8px 32px 0 rgba(2, 132, 199, 0.1);
    
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-full: 9999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: var(--font-fam);
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

/* Typography */
h1, h2, h3 { color: var(--text-main); font-weight: 600; }
a { text-decoration: none; color: var(--primary-color); }

/* Layout Utilities */
.mt-4 { margin-top: 1rem; }
.mt-6 { margin-top: 1.5rem; }

/* Glass Button & Interactions */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius-md);
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 0.95rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
    box-shadow: var(--shadow-md);
}

.btn-primary:hover {
    background-color: var(--primary-dark);
    transform: translateY(-2px);
}

.btn-secondary {
    background-color: transparent;
    color: var(--primary-dark);
    border: 1px solid var(--primary-light);
}

.btn-secondary:hover {
    background-color: var(--bg-main);
}

.btn-block { width: 100%; }

.btn-icon {
    background: transparent;
    border: none;
    font-size: 1.25rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: color 0.2s;
}
.btn-icon:hover { color: var(--primary-color); }

/* Forms & Inputs */
.form-layout {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}
.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}
@media (max-width: 768px) {
    .form-row { grid-template-columns: 1fr; }
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.input-group label {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-muted);
}

.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
}

input, select {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    outline: none;
    font-size: 0.95rem;
    transition: all 0.2s;
    background-color: #f8fafc;
}

.input-wrapper input {
    padding-left: 2.75rem;
}

input:focus, select:focus {
    border-color: var(--primary-light);
    box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.2);
    background-color: white;
}

/* Glassmorphism Panels */
.glass-panel {
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    box-shadow: var(--shadow-glass);
    border-radius: var(--radius-lg);
    padding: 2rem;
}

/* --- Views CSS --- */

/* Login */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    background: linear-gradient(135deg, var(--bg-main) 0%, #e0f2fe 100%);
}

.login-card {
    width: 100%;
    max-width: 400px;
}

.login-header {
    text-align: center;
    margin-bottom: 2rem;
}

.header-icon {
    font-size: 3rem;
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.error-text {
    color: var(--error-color);
    font-size: 0.875rem;
    margin-top: 0.75rem;
    text-align: center;
}

/* Layout Main App */
.layout {
    display: flex;
    height: 100vh;
    overflow: hidden;
}

.sidebar {
    width: 260px;
    background-color: var(--bg-sidebar);
    color: var(--text-light);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    z-index: 10;
}

.sidebar-brand {
    padding: 2rem 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
}

.sidebar-brand i { color: var(--primary-light); }

.sidebar-nav {
    display: flex;
    flex-direction: column;
    padding: 1.5rem 1rem;
    gap: 0.5rem;
}

.nav-item {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.7);
    padding: 1rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}

.nav-item:hover, .nav-item.active {
    background-color: rgba(255,255,255,0.1);
    color: white;
}
.nav-item.active {
    border-left: 4px solid var(--primary-light);
}

.sidebar-footer {
    margin-top: auto;
    padding: 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
    font-size: 0.75rem;
    color: rgba(255,255,255,0.5);
    text-align: center;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    background: linear-gradient(to bottom, #f0f9ff 0%, #ffffff 100%);
}

.topbar {
    padding: 1.5rem 2.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 5;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 1rem;
    font-weight: 500;
}

.avatar {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-full);
    background-color: var(--primary-light);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.content-area {
    padding: 2.5rem;
    flex: 1;
}

/* Dashboard View */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.5rem;
}

.stat-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-glass);
    display: flex;
    align-items: center;
    gap: 1.5rem;
    border: 1px solid var(--border-color);
}

.stat-icon {
    width: 60px;
    height: 60px;
    border-radius: var(--radius-md);
    background-color: var(--bg-main);
    color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
}

@keyframes pulse-soft {
    0% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0.4); }
    70% { box-shadow: 0 0 0 10px rgba(2, 132, 199, 0); }
    100% { box-shadow: 0 0 0 0 rgba(2, 132, 199, 0); }
}

.pulse {
    animation: pulse-soft 2s infinite;
}

.stat-info {
    display: flex;
    flex-direction: column;
}

.stat-label {
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
}

.stat-value {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-main);
}

.actions-flex {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* Tables */
.table-responsive {
    overflow-x: auto;
}

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

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

.table th {
    background-color: var(--bg-main);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-radius: 8px 8px 0 0;
}

.table tbody tr {
    transition: background-color 0.2s;
}

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

.badge {
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-success { background: #d1fae5; color: #065f46; }
.badge-danger { background: #fee2e2; color: #991b1b; }

/* Toast Notification */
#toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 3000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: white;
    border-left: 4px solid var(--primary-color);
    box-shadow: var(--shadow-md);
    padding: 1rem 1.5rem;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    animation: slideIn 0.3s ease-out forwards;
}

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

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* Permissions Grid */
.permissions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    background: rgba(255, 255, 255, 0.5);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.permission-item input[type="checkbox"] {
    width: auto;
    accent-color: var(--primary-color);
    transform: scale(1.2);
    cursor: pointer;
}

.permission-item label {
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-main);
}

/* Filtros bar */
.filtros-bar {
    padding: 1rem 1.5rem;
}
.filtros-bar .form-row {
    align-items: flex-end;
}

/* Total bar */
.total-bar {
    padding: 0.75rem 1rem;
    font-weight: 600;
    color: var(--primary-dark);
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border-color);
    min-height: 2.5rem;
}

/* View header */
.view-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.view-header h2 {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* mb-4 utility */
.mb-4 { margin-bottom: 1rem; }

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
}
.modal-content {
    background: var(--bg-card);
    width: 90%;
    max-width: 600px;
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-glass);
}
.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    border-bottom: 1px solid var(--border-color);
}
.modal-body {
    padding: 1.5rem;
    max-height: 70vh;
    overflow-y: auto;
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
    #mobile-menu-btn {
        display: flex !important;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        background: white;
        border-radius: var(--radius-md);
        box-shadow: var(--shadow-sm);
        color: var(--primary-color);
        border: 1px solid var(--border-color);
    }
    
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
        width: 280px;
    }
    
    .sidebar.open {
        transform: translateX(0);
    }
    
    .topbar {
        padding: 1rem;
        gap: 1rem;
    }

    .content-area {
        padding: 1rem;
    }

    /* Modal Mobile */
    .modal-content {
        width: 95%;
        margin: 1rem;
    }
    
    /* Overlay for sidebar */
    .sidebar-overlay {
        display: none;
        position: fixed;
        top: 0; left: 0; right: 0; bottom: 0;
        background: rgba(15, 23, 42, 0.5);
        z-index: 999;
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
    }
    .sidebar-overlay.active {
        display: block;
    }

    /* Dashboard grids */
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .view-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.75rem;
    }
    
    .view-header button {
        width: 100%;
    }

    .search-bar, .filtros-bar > div {
        flex-direction: column;
        align-items: stretch !important;
    }

    .search-bar .btn, .filtros-bar .btn {
        width: 100%;
    }

    /* Forms */
    .glass-panel {
        padding: 1.25rem;
    }

    /* Tables responsiveness */
    .table-responsive {
        margin: 0 -1.25rem;
        padding: 0 1.25rem;
        width: calc(100% + 2.5rem);
    }
    
    table {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }
}

/* User Profile Dropdown */
.user-profile {
    position: relative;
    cursor: pointer;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    transition: background 0.2s;
}
.user-profile:hover {
    background: rgba(0,0,0,0.05);
}

.profile-dropdown {
    position: absolute;
    top: calc(100% + 5px);
    right: 0;
    width: 200px;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border-color);
    display: none;
    flex-direction: column;
    padding: 0.5rem 0;
    z-index: 100;
}
.profile-dropdown.active {
    display: flex;
}

.dropdown-item {
    background: transparent;
    border: none;
    padding: 0.75rem 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-main);
    font-size: 0.95rem;
    cursor: pointer;
    transition: background 0.2s;
    width: 100%;
    text-align: left;
}
.dropdown-item:hover {
    background: var(--bg-main);
}
.dropdown-item i {
    color: var(--primary-color);
    font-size: 1.1rem;
}
.dropdown-divider {
    height: 1px;
    background: var(--border-color);
    margin: 0.5rem 0;
}

/* Autocomplete searchable select */
.autocomplete-results {
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    max-height: 250px;
    background: white;
    border: 1px solid var(--border-color);
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 1000;
    overflow-y: auto;
}
.autocomplete-item {
    padding: 0.75rem 1rem;
    cursor: pointer;
    border-bottom: 1px solid rgba(0,0,0,0.05);
    transition: background 0.2s;
    display: flex;
    flex-direction: column;
}
.autocomplete-item:hover {
    background: var(--bg-main);
}
.autocomplete-item strong {
    color: var(--primary-dark);
}
.autocomplete-item small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* ===========================
   Permission Groups
   =========================== */
#permissions-container {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    margin-top: 0.5rem;
}

.perm-group {
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    overflow: hidden;
}

.perm-group-header {
    background: linear-gradient(135deg, rgba(var(--primary-rgb, 99,102,241),0.15), rgba(var(--primary-rgb, 99,102,241),0.05));
    border-bottom: 1px solid var(--border-color);
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--text-main);
    text-transform: uppercase;
}

.perm-group-items {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.1rem;
    padding: 0.75rem;
}

.permission-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.15s;
}

.permission-item:hover {
    background: rgba(255,255,255,0.06);
}

.permission-item input[type="checkbox"] {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: var(--primary-color);
    cursor: pointer;
    flex-shrink: 0;
}

.permission-item label {
    font-size: 0.88rem;
    color: var(--text-secondary);
    cursor: pointer;
    line-height: 1.3;
}

.permission-item label strong {
    color: var(--text-main);
    font-weight: 600;
}

/* ===========================
   Pagination
   =========================== */
.pagination-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    margin-top: 1rem;
}

.pagination-info {
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.pagination-btn {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    border: 1px solid var(--border-color);
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
}

.pagination-btn:hover:not(:disabled) {
    background: var(--primary-color);
    border-color: var(--primary-color);
    transform: translateY(-2px);
}

.pagination-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.pagination-btn.active {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.pagination-settings {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.per-page-select {
    padding: 0.4rem 0.6rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-main);
    cursor: pointer;
}

.per-page-select:focus {
    outline: none;
    border-color: var(--primary-color);
}

/* ===== Parcelamento ===== */
.parcelas-section {
    padding: 1.25rem 1.5rem;
    border-radius: var(--border-radius);
    border: 1px solid var(--border-color);
}

.parcela-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

.parcela-toggle {
    display: flex;
    gap: 0.75rem;
}

.parcela-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.25rem;
    border-radius: 50px;
    border: 2px solid var(--border-color);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
}

.parcela-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.parcela-btn.active {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    border-color: transparent;
    color: #fff;
    box-shadow: 0 4px 12px rgba(var(--primary-rgb), 0.35);
}

.parcela-preview-box {
    padding: 0.65rem 1rem;
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-color);
    min-height: 2.5rem;
    display: flex;
    align-items: center;
}

.parcela-preview-lista {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 0.65rem;
    margin-top: 0.5rem;
}

.parcela-preview-item {
    background: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.6rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.85rem;
    transition: border-color 0.2s;
}

.parcela-preview-item:last-child {
    border-color: var(--primary-color);
    background: rgba(var(--primary-rgb), 0.04);
}

.parcela-preview-item .pi-comp {
    font-weight: 700;
    color: var(--text-primary);
}

.parcela-preview-item .pi-idx {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.parcela-preview-item .pi-valor {
    font-weight: 600;
    color: var(--success-color);
}

.parcela-preview-item.pi-ajuste .pi-valor::after {
    content: " (ajuste)";
    font-size: 0.7rem;
    color: var(--warning-color, #f59e0b);
}

/* --- Pastoral Expansion Styles --- */
.pastoral-row {
    display: flex;
    gap: 1rem;
    align-items: flex-end;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border-color);
}
.pastoral-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}
.pastoral-row .input-group {
    flex: 1;
}
.pastorais-checkbox-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 1rem;
    padding: 1rem;
    background: rgba(2, 132, 199, 0.03);
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
}
.pastoral-checkbox-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
}
.pastoral-checkbox-item input {
    width: auto;
    cursor: pointer;
}
.pastoral-checkbox-item label {
    margin-bottom: 0;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}

/* Missa Servos Escalados */
.servos-details-container {
    padding: 1.5rem;
    background: #f8fafc;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
    border: 1px solid var(--border-color);
    border-top: none;
    margin-top: -1px;
    animation: slideDown 0.3s ease-out;
}

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

.pastoral-servos-group {
    margin-bottom: 2rem;
}

.pastoral-servos-group h4 {
    color: var(--primary-dark);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 2px solid var(--primary-light);
    padding-bottom: 0.5rem;
}

.servos-slots-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1rem;
}

.servo-slot {
    background: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 1px dashed var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.2s;
}

.servo-slot.assigned {
    border-style: solid;
    border-color: var(--primary-light);
    background: rgba(56, 189, 248, 0.05);
}

.servo-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.servo-info i {
    font-size: 1.25rem;
    color: var(--text-muted);
}

.assigned .servo-info i {
    color: var(--primary-color);
}

.servo-slot .btn-assign {
    color: var(--primary-color);
    background: transparent;
    border: 1px solid var(--primary-color);
    padding: 0.25rem 0.75rem;
    border-radius: var(--radius-full);
    font-size: 0.85rem;
}

.servo-slot .btn-assign:hover {
    background: var(--primary-color);
    color: white;
}

.servo-slot .btn-remove-servo {
    color: var(--error-color);
    font-size: 1.15rem;
    background: transparent;
    border: none;
    cursor: pointer;
}

/* Central de Relatórios */
.reports-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 1.5rem;
}

.report-card {
    display: flex;
    align-items: center;
    padding: 1.5rem;
    gap: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border-color);
}

.report-card:hover {
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: var(--shadow-md);
}

.report-icon {
    width: 50px;
    height: 50px;
    background: rgba(2, 132, 199, 0.1);
    color: var(--primary-color);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.report-info { flex: 1; }
.report-info h3 { font-size: 1.1rem; margin-bottom: 0.25rem; color: var(--text-main); }
.report-info p { font-size: 0.85rem; color: var(--text-muted); line-height: 1.4; }

/* Report Print Container */
.report-print-container {
    background: white;
    padding: 2cm;
    min-height: 29.7cm; /* A4 height */
    color: #1e293b;
    font-family: 'Inter', sans-serif;
}

.report-header {
    text-align: center;
    margin-bottom: 2rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 1.5rem;
}

.report-header h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
.report-header p { color: #64748b; font-size: 0.9rem; }

.report-section {
    margin-bottom: 1.5rem;
    break-inside: avoid;
}

.report-mass-header {
    background: #f1f5f9;
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    font-weight: 600;
    border: 1px solid #cbd5e1;
    font-size: 1rem;
}

.report-pastoral-group {
    border: 1px solid #e2e8f0;
    border-top: none;
    padding: 1rem;
}

.report-pastoral-title {
    font-weight: 700;
    color: #475569;
    margin-bottom: 0.5rem;
    border-bottom: 1px dashed #cbd5e1;
    padding-bottom: 0.25rem;
}

.report-servos-list {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.report-servo-item {
    font-size: 0.95rem;
    padding: 0.25rem 0.5rem;
}

.report-servo-item.vago {
    color: #94a3b8;
    font-style: italic;
}

/* Print Card styles */
.print-only { display: none; }

.print-card-wrapper {
    width: 100%;
    font-family: Arial, sans-serif;
    color: #000;
    font-size: 12pt;
    line-height: 1.4;
    background: white;
}
.print-header {
    text-align: center;
    border: 1px solid #000;
    margin-bottom: -1px; /* collapse border */
}
.print-paroquia {
    padding: 4px;
    border-bottom: 1px solid #000;
}
.print-missa {
    padding: 4px;
    font-weight: bold;
    font-size: 14pt;
}
.print-table {
    width: 100%;
    border-collapse: collapse;
}
.print-table th, .print-table td {
    border: 1px solid #000;
    padding: 6px 8px;
}
.print-table th:first-child, .print-table td:first-child {
    text-align: left;
}
.print-table th:last-child, .print-table td:last-child {
    text-align: right;
}
.print-table th[colspan="2"] {
    text-align: left;
}
.print-table th.print-header-cell {
    text-align: center !important;
}
.print-table th {
    font-weight: normal;
    font-size: 12pt;
}
.print-value-large {
    font-size: 16pt;
    color: #00008b;
    font-family: 'Segoe Print', 'Comic Sans MS', cursive;
}
.print-value-money {
    font-size: 16pt;
    color: #00008b;
    font-family: 'Segoe Print', 'Comic Sans MS', cursive;
}

/* Print Rules */
@media print {
    body { background: white !important; margin: 0; padding: 0; }
    
    /* Global hides for printing any report */
    .sidebar, .topbar, .no-print, .btn, .view-header, #toast-container, #app-container { 
        display: none !important; 
    }
    
    /* Hide ALL printable sections by default */
    #print-resumo-card, #modal-calcula-ofertas { 
        display: none !important; 
    }

    /* --- MODE: Resumo de Missa (A6) --- */
    body.print-resumo-missa #print-resumo-card { 
        display: block !important; 
    }
    body.print-resumo-missa #print-resumo-card * { 
        visibility: visible !important; 
    }

    /* --- MODE: Calcula Ofertas (A4) --- */
    body.print-calcula-ofertas #modal-calcula-ofertas { 
        display: block !important; 
        position: static !important;
        width: 100% !important;
        background: transparent !important;
    }
    body.print-calcula-ofertas #modal-calcula-ofertas .modal-content {
        max-height: none !important;
        height: auto !important;
        box-shadow: none !important;
        border: none !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
    }
    body.print-calcula-ofertas #modal-calcula-ofertas * { 
        visibility: visible !important; 
    }
    body.print-calcula-ofertas .ofertas-flex-container { 
        flex-wrap: nowrap !important; 
        gap: 2rem !important; 
    }
    body.print-calcula-ofertas .ofertas-flex-container > div { 
        flex: 1 1 50% !important; 
    }
    body.print-calcula-ofertas table.table-ofertas { 
        display: table !important; 
        width: 100% !important; 
    }
    body.print-calcula-ofertas table.table-ofertas th, 
    body.print-calcula-ofertas table.table-ofertas td { 
        display: table-cell !important; 
        font-size: 1.1rem !important; 
        padding: 0.5rem !important; 
        white-space: nowrap !important;
    }
    body.print-calcula-ofertas .print-only { 
        display: block !important; 
    }

    /* Common layout fixes for print */
    .layout { display: block !important; }
    .main-content, .content-area, .report-print-container {
        padding: 0 !important;
        margin: 0 !important;
        box-shadow: none !important;
        border: none !important;
    }
    .glass-panel { background: white !important; border: none !important; box-shadow: none !important; }
}
