:root {
    --bg: #f0fdf4;
    --surface: #ffffff;
    --surface-hover: #f0fdf4;
    --border: #d1e7dd;
    --text: #1a2e1a;
    --text-muted: #4a6741;
    --accent: #16a34a;
    --accent-hover: #15803d;
    --accent-light: #dcfce7;
    --success: #16a34a;
    --warning: #f59e0b;
    --danger: #ef4444;
    --sidebar-bg: #14532d;
    --sidebar-text: #bbf7d0;
    --sidebar-active: #4ade80;
    --shadow: 0 1px 3px rgba(0,0,0,0.1);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
}

/* === SIDEBAR === */
.sidebar {
    width: 260px;
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
    transition: transform 0.3s;
}
.sidebar-header {
    padding: 1.5rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.sidebar-logo {
    width: 100%;
    max-width: 180px;
    height: auto;
    margin-bottom: 0.5rem;
    background: transparent;
    border: none;
    outline: none;
    display: block;
}
.sidebar-title {
    font-size: 0.75rem;
    color: var(--sidebar-text);
    font-weight: 500;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    opacity: 0.8;
}
.sidebar-header h1 {
    font-size: 1.25rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.sidebar-nav {
    flex: 1;
    padding: 1rem 0;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.875rem 1.5rem;
    color: var(--sidebar-text);
    cursor: pointer;
    transition: all 0.2s;
    border-left: 3px solid transparent;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
}
a.nav-item {
    color: var(--sidebar-text) !important;
    text-decoration: none !important;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
a.nav-item:visited { color: var(--sidebar-text) !important; }
a.nav-item:hover {
    color: #fff !important;
    text-decoration: none !important;
    background: rgba(255,255,255,0.05);
}
a.nav-item.active {
    color: var(--sidebar-active) !important;
    text-decoration: none !important;
    background: rgba(22, 163, 74, 0.1);
    border-left-color: var(--sidebar-active);
}
.nav-item:hover {
    background: rgba(255,255,255,0.05);
    color: #fff;
}
.nav-item.active {
    background: rgba(22, 163, 74, 0.1);
    color: var(--sidebar-active);
    border-left-color: var(--sidebar-active);
}
.nav-icon { font-size: 1.1rem; width: 24px; text-align: center; }
.sidebar-footer {
    padding: 1rem 1.5rem;
    border-top: 1px solid rgba(255,255,255,0.1);
}
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
}
.user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 600;
    font-size: 0.9rem;
}
.user-details { flex: 1; }
.user-name { color: #fff; font-size: 0.9rem; font-weight: 500; }
.user-role { color: var(--sidebar-text); font-size: 0.75rem; }
.btn-logout {
    width: 100%;
    padding: 0.5rem;
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 6px;
    color: var(--sidebar-text);
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}
.btn-logout:hover { background: rgba(239, 68, 68, 0.2); color: #fca5a5; }

/* === MAIN CONTENT === */
.main-content {
    flex: 1;
    margin-left: 260px;
    padding: 2rem;
    min-height: 100vh;
}
.page-header {
    margin-bottom: 2rem;
}
.page-title {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--text);
}
.page-subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

/* === CARDS === */
.card {
    background: var(--surface);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    margin-bottom: 1.5rem;
}
.card-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.card-title {
    font-size: 1rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.card-body { padding: 1.5rem; }

/* === FORMS === */
.form-group { margin-bottom: 1rem; }
.form-label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}
.form-control {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 0.95rem;
    outline: none;
    transition: all 0.2s;
}
.form-control:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.form-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
}

/* === BUTTONS === */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}
.btn-primary {
    background: var(--accent);
    color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--surface-hover); }
.btn-danger {
    background: var(--danger);
    color: #fff;
}
.btn-sm { padding: 0.5rem 1rem; font-size: 0.85rem; }
.btn-icon {
    width: 32px;
    height: 32px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
}

/* === SEARCH BOX === */
.search-container {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.search-container .form-control { flex: 1; min-width: 200px; }

/* === STATUS BAR === */
.status-bar {
    padding: 1rem 1.25rem;
    border-radius: 8px;
    margin-bottom: 1.5rem;
    font-size: 0.9rem;
    display: none;
    align-items: center;
    gap: 0.5rem;
}
.status-bar.info { background: var(--accent-light); color: var(--accent); display: flex; }
.status-bar.error { background: #fef2f2; color: var(--danger); display: flex; }
.status-bar.success { background: #d1fae5; color: var(--success); display: flex; }

/* === HOME DASHBOARD === */
.home-hero {
    background: linear-gradient(135deg, #14532d 0%, #166534 45%, #15803d 100%);
    border-radius: 16px;
    padding: 1.75rem 2rem;
    color: #fff;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1.5rem;
    flex-wrap: wrap;
    box-shadow: var(--shadow-md);
}
.home-hero h2 { font-size: 1.5rem; font-weight: 700; margin-bottom: 0.35rem; }
.home-hero p { opacity: 0.85; font-size: 0.95rem; max-width: 420px; }
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 1rem;
    margin-bottom: 1.5rem;
}
.kpi-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.15rem 1.25rem;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    position: relative;
    overflow: hidden;
}
.kpi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.kpi-card::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 4px;
}
.kpi-card.kpi-pendente::before { background: #f59e0b; }
.kpi-card.kpi-processo::before { background: #3b82f6; }
.kpi-card.kpi-concluido::before { background: #10b981; }
.kpi-card.kpi-financeiro::before { background: #8b5cf6; }
.kpi-card.kpi-total::before { background: #14532d; }
.kpi-value { font-size: 2rem; font-weight: 700; line-height: 1.1; color: var(--text); }
.kpi-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 0.35rem; font-weight: 500; }
.home-panels {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.25rem;
}
.home-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
}
.home-stat-row:last-child { border-bottom: none; }
.home-bar {
    height: 8px;
    background: var(--accent-light);
    border-radius: 4px;
    margin-top: 0.35rem;
    overflow: hidden;
}
.home-bar > span {
    display: block;
    height: 100%;
    background: var(--accent);
    border-radius: 4px;
}
.home-meta {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.5rem;
}
.home-meta-chip {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.home-meta-chip strong { color: var(--text); }

/* === FINANCEIRO MODAL === */
.fin-mode-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
}
.fin-mode-card {
    border: 2px solid var(--border);
    border-radius: 12px;
    padding: 1rem 1.15rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    display: flex;
    gap: 0.85rem;
    align-items: flex-start;
    background: #fff;
}
.fin-mode-card:hover { border-color: #86efac; background: #f0fdf4; }
.fin-mode-card.active {
    border-color: var(--accent);
    background: var(--accent-light);
}
.fin-mode-card input { margin-top: 0.2rem; accent-color: var(--accent); }
.fin-mode-card h4 { font-size: 0.95rem; margin-bottom: 0.2rem; color: var(--text); }
.fin-mode-card p { font-size: 0.8rem; color: var(--text-muted); margin: 0; }
.fin-extra { display: none; margin-bottom: 1rem; }
.fin-extra.visible { display: block; }
.fin-preview {
    background: #f8fafc;
    border: 1px dashed var(--border);
    border-radius: 10px;
    padding: 1rem;
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.fin-preview strong { color: var(--accent); font-size: 1.35rem; display: block; margin-bottom: 0.25rem; }

/* === RESULTS === */
.result-grid {
    display: none;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 1.5rem;
}
.result-grid.active { display: grid; }
.data-row {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
}
.data-row:last-child { border-bottom: none; }
.data-label { color: var(--text-muted); font-size: 0.9rem; }
.data-value { font-weight: 500; text-align: right; max-width: 60%; word-break: break-word; }

/* === LIST ITEMS === */
.item-list { list-style: none; }
.item-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.75rem;
    transition: all 0.2s;
}
.item-card:hover { border-color: var(--accent); }
.item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}
.item-number { font-weight: 600; color: var(--accent); }
.item-badge {
    background: var(--surface);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    color: var(--text-muted);
    border: 1px solid var(--border);
}
.btn-add {
    background: var(--success);
    color: #fff;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}
.btn-add:hover { transform: scale(1.1); background: #059669; }

/* === TABLE === */
.table-container { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.75rem 1rem; text-align: left; border-bottom: 1px solid var(--border); }
th {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
    background: var(--bg);
}
tr:hover td { background: var(--surface-hover); }

/* === INLINE EDITABLE FIELDS (premium) === */
.inline-select {
    appearance: none;
    -webkit-appearance: none;
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 28px 6px 10px;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    min-width: 140px;
}
.inline-select:hover {
    border-color: var(--accent);
    box-shadow: 0 2px 4px rgba(22, 163, 74, 0.1);
}
.inline-select:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.inline-input {
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
    width: 100%;
    background: transparent;
    color: var(--text);
    transition: all 0.2s ease;
}
.inline-input:hover {
    background: var(--bg);
    border-color: var(--border);
}
.inline-input:focus {
    outline: none;
    background: #fff;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}
.inline-input::placeholder {
    color: #cbd5e1;
    font-style: italic;
}

.inline-number {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    font-size: 0.8rem;
    font-weight: 600;
    width: 100px;
    background: linear-gradient(to bottom, #ffffff, #f8fafc);
    color: var(--success);
    transition: all 0.2s ease;
    box-shadow: 0 1px 2px rgba(0,0,0,0.04);
    text-align: right;
}
.inline-number:hover {
    border-color: var(--success);
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.1);
}
.inline-number:focus {
    outline: none;
    border-color: var(--success);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15);
    background: #fff;
}
.inline-number::placeholder {
    color: #cbd5e1;
    font-weight: 400;
}

.recibo-cell {
    display: flex;
    align-items: center;
    gap: 4px;
}
.recibo-prefix {
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 600;
}

/* === LOGIN === */
.login-overlay {
    position: fixed;
    inset: 0;
    background: linear-gradient(135deg, #14532d 0%, #166534 50%, #15803d 100%);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-box {
    background: #ffffff;
    border-radius: 20px;
    padding: 2.5rem 2rem;
    width: 90%;
    max-width: 420px;
    box-shadow: 0 25px 50px -12px rgba(0,0,0,0.25);
}
.login-logo {
    display: block;
    margin: 0 auto 0.5rem;
    max-width: 220px;
    height: auto;
}
.login-box h2 {
    font-size: 1.1rem;
    margin-bottom: 0.25rem;
    text-align: center;
    color: #14532d;
    font-weight: 600;
    letter-spacing: 0.02em;
}
.login-box .form-control {
    margin-bottom: 1rem;
    border: 1.5px solid #d1e7dd !important;
    border-radius: 10px !important;
    background: #f0fdf4 !important;
    outline: none !important;
    box-shadow: none !important;
}
.login-box .form-control:focus {
    border-color: #16a34a !important;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15) !important;
    background: #ffffff !important;
}
.login-box .btn { width: 100%; justify-content: center; }
.login-error {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: 1rem;
    text-align: center;
    display: none;
}

/* === MODAL === */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.6);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 1rem;
}
.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px) scale(0.97); } to { opacity: 1; transform: translateY(0) scale(1); } }
.modal-content, .modal-box {
    background: #ffffff;
    border-radius: 20px;
    width: 100%;
    max-width: 560px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(0,0,0,0.05);
    display: flex;
    flex-direction: column;
    animation: slideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal-header {
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(to bottom, #f8fafc, #ffffff);
}
.modal-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #0f172a;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    overflow-x: hidden;
    flex: 1;
}
.modal-body .form-group {
    margin-bottom: 1.25rem;
    width: 100%;
}
.modal-body .form-group input:not([type="checkbox"]):not([type="radio"]),
.modal-body .form-group select,
.modal-body .form-group textarea {
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: block !important;
}
.modal-body .form-group input[type="checkbox"],
.modal-body .form-group input[type="radio"] {
    width: 18px !important;
    min-width: 18px !important;
    max-width: 18px !important;
    height: 18px !important;
    display: inline-block !important;
    margin: 0 !important;
    flex-shrink: 0 !important;
    accent-color: #16a34a !important;
}
.modal-body .form-group:last-child {
    margin-bottom: 0;
}
.modal-body label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.5rem;
}
.modal-body input[type="text"],
.modal-body input[type="number"],
.modal-body input[type="date"],
.modal-body input[type="password"],
.modal-body .modal-input {
    width: 100% !important;
    padding: 0.625rem 0.875rem !important;
    border: 1.5px solid #d1e7dd !important;
    border-radius: 10px !important;
    font-size: 0.9rem !important;
    color: #1a2e1a !important;
    background: #f0fdf4 !important;
    transition: all 0.2s ease;
    box-sizing: border-box !important;
    height: 44px !important;
    line-height: 1.4 !important;
    display: block !important;
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none !important;
    appearance: none !important;
}
.modal-body input[type="text"]:hover,
.modal-body input[type="number"]:hover,
.modal-body input[type="date"]:hover,
.modal-body input[type="password"]:hover {
    border-color: #16a34a !important;
    background: #ffffff !important;
}
.modal-body input[type="text"]:focus,
.modal-body input[type="number"]:focus,
.modal-body input[type="date"]:focus,
.modal-body input[type="password"]:focus {
    outline: none !important;
    border-color: #16a34a !important;
    background: #ffffff !important;
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.15) !important;
}
.modal-close {
    background: #f1f5f9;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    font-size: 1.1rem;
    cursor: pointer;
    color: #64748b;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.modal-close:hover {
    background: #fee2e2;
    color: #ef4444;
}
/* Edit item rows inside modal */
.edit-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
    animation: fadeIn 0.15s ease;
}
.edit-item-row input {
    flex: 1;
    padding: 0.5rem 0.75rem !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 8px !important;
    font-size: 0.875rem !important;
    background: #ffffff !important;
    color: #0f172a !important;
    transition: all 0.2s ease;
}
.edit-item-row input:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 3px var(--accent-light) !important;
    outline: none;
}
.edit-item-remove {
    background: #fef2f2;
    color: #ef4444;
    border: 1.5px solid #fecaca;
    border-radius: 8px;
    width: 34px;
    height: 34px;
    cursor: pointer;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
}
.edit-item-remove:hover {
    background: #ef4444;
    color: #ffffff;
    border-color: #ef4444;
}
.edit-add-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--accent-light);
    color: var(--accent);
    border: 1.5px dashed var(--accent);
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 4px;
}
.edit-add-btn:hover {
    background: var(--accent);
    color: #ffffff;
    border-style: solid;
}
.edit-section-label {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}
.edit-section-label span {
    font-size: 0.8rem;
    font-weight: 600;
    color: #475569;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.modal-save-btn {
    width: 100%;
    padding: 0.75rem;
    background: linear-gradient(135deg, var(--accent), #15803d);
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(22, 163, 74, 0.3);
    margin-top: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}
.modal-save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(22, 163, 74, 0.4);
}
.modal-save-btn:active {
    transform: translateY(0);
}

/* === LOADING === */
.spinner {
    width: 18px;
    height: 18px;
    border: 2px solid var(--accent-light);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* === EMPTY STATE === */
.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}
.empty-icon { font-size: 3rem; margin-bottom: 1rem; opacity: 0.5; }

/* === DATA TABLE TOOLBAR === */
.datatable-toolbar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1rem;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    background: #fff;
}
.datatable-search {
    flex: 1;
    min-width: 200px;
    position: relative;
}
.datatable-search input {
    width: 100%;
    padding: 0.5rem 0.75rem 0.5rem 2.25rem;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 0.85rem;
    background: #ffffff;
    color: var(--text);
    transition: all 0.2s;
    outline: none;
    box-shadow: none;
}
.datatable-search input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
    background: #ffffff;
    outline: none;
}
.modal-date-input {
    display: block !important;
    width: 100% !important;
    box-sizing: border-box !important;
    padding: 0.625rem 0.875rem !important;
    border: 1.5px solid #e2e8f0 !important;
    border-radius: 10px !important;
    font-size: 0.95rem !important;
    font-family: inherit !important;
    background: #f8fafc !important;
    color: var(--text) !important;
    height: 44px !important;
    line-height: 1.4 !important;
    cursor: pointer !important;
    transition: all 0.2s;
    outline: none;
    box-shadow: none;
}
.modal-date-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.1);
    background: #ffffff;
    outline: none;
}
.modal-date-input::-webkit-calendar-picker-indicator {
    cursor: pointer;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.modal-date-input::-webkit-calendar-picker-indicator:hover {
    opacity: 1;
}
.datatable-search::before {
    content: '🔍';
    position: absolute;
    left: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    opacity: 0.4;
}
.datatable-filter {
    padding: 0.35rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.78rem;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}
.datatable-filter:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(22, 163, 74, 0.15);
}
.datatable-pagesize {
    padding: 0.35rem 0.4rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 0.78rem;
    background: #fff;
    color: var(--text);
    cursor: pointer;
    margin-left: auto;
}

/* === PAGINATION === */
.datatable-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
    border-top: 1px solid var(--border);
    font-size: 0.8rem;
    color: var(--text-muted);
    flex-wrap: wrap;
    gap: 0.5rem;
}
.datatable-info { white-space: nowrap; }
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}
.pagination button {
    padding: 0.375rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface);
    color: var(--text);
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.15s;
    min-width: 32px;
    text-align: center;
}
.pagination button:hover:not(:disabled) {
    background: var(--accent-light);
    border-color: var(--accent);
    color: var(--accent);
}
.pagination button.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
    font-weight: 600;
}
.pagination button:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* === SORTABLE TH === */
th.sortable {
    cursor: pointer;
    user-select: none;
    position: relative;
    padding-right: 1.25rem;
}
th.sortable::after {
    content: '⇅';
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.7rem;
    opacity: 0.3;
}
th.sortable.asc::after { content: '↑'; opacity: 0.8; color: var(--accent); }
th.sortable.desc::after { content: '↓'; opacity: 0.8; color: var(--accent); }
th.sortable:hover { color: var(--accent); }

/* === FLAG FINANCEIRO === */
.fin-flag {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    font-size: 0.75rem;
    font-weight: 700;
    color: #fff;
    line-height: 1;
    vertical-align: middle;
}
.fin-flag-ok { background: #16a34a; box-shadow: 0 0 0 2px #bbf7d0; }
.fin-flag-no { background: #ef4444; box-shadow: 0 0 0 2px #fecaca; }

.smtp-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.65rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}
.smtp-badge-ok { background: #dcfce7; color: #166534; }
.smtp-badge-erro { background: #fee2e2; color: #991b1b; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle {
        display: flex;
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 101;
        background: var(--sidebar-bg);
        color: #fff;
        border: none;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        align-items: center;
        justify-content: center;
        cursor: pointer;
    }
}
@media (min-width: 769px) {
    .menu-toggle { display: none; }
}
