/**
 * =====================================================
 * VISAR FINANCE - Sistema Financeiro para Clínica Médica
 * Estilos principais - Design moderno, minimalista e responsivo
 * Com suporte a Dark Mode
 * =====================================================
 */

/* ===== VARIÁVEIS CSS (TEMA CLARO) ===== */
:root {
    --cor-primaria: #2563EB;
    --cor-primaria-hover: #1D4ED8;
    --cor-primaria-light: #DBEAFE;
    --cor-sucesso: #059669;
    --cor-sucesso-light: #D1FAE5;
    --cor-perigo: #DC2626;
    --cor-perigo-light: #FEE2E2;
    --cor-aviso: #D97706;
    --cor-aviso-light: #FEF3C7;
    --cor-info: #0891B2;
    --cor-info-light: #CFFAFE;

    --bg-body: #F3F4F6;
    --bg-card: #FFFFFF;
    --bg-sidebar: #1F2937;
    --bg-sidebar-hover: #374151;
    --bg-sidebar-active: #2563EB;
    --bg-input: #FFFFFF;
    --bg-table-header: #F9FAFB;
    --bg-table-row-hover: #F3F4F6;

    --texto-primario: #111827;
    --texto-secundario: #6B7280;
    --texto-sidebar: #D1D5DB;
    --texto-sidebar-active: #FFFFFF;

    --borda: #E5E7EB;
    --borda-input: #D1D5DB;
    --borda-input-focus: #2563EB;

    --sombra-card: 0 1px 3px rgba(0, 0, 0, 0.1), 0 1px 2px rgba(0, 0, 0, 0.06);
    --sombra-card-hover: 0 4px 6px rgba(0, 0, 0, 0.1);
    --sombra-modal: 0 20px 25px rgba(0, 0, 0, 0.15);

    --sidebar-width: 260px;
    --header-height: 64px;
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* ===== TEMA ESCURO ===== */
[data-theme="escuro"] {
    --bg-body: #111827;
    --bg-card: #1F2937;
    --bg-sidebar: #0F172A;
    --bg-sidebar-hover: #1E293B;
    --bg-input: #374151;
    --bg-table-header: #1F2937;
    --bg-table-row-hover: #374151;

    --texto-primario: #F9FAFB;
    --texto-secundario: #9CA3AF;

    --borda: #374151;
    --borda-input: #4B5563;

    --sombra-card: 0 1px 3px rgba(0, 0, 0, 0.3);
    --cor-primaria-light: #1E3A5F;
    --cor-sucesso-light: #064E3B;
    --cor-perigo-light: #7F1D1D;
    --cor-aviso-light: #78350F;
    --cor-info-light: #164E63;
}

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

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background-color: var(--bg-body);
    color: var(--texto-primario);
    line-height: 1.6;
    transition: var(--transition);
}

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

a:hover {
    color: var(--cor-primaria-hover);
}

/* ===== LAYOUT PRINCIPAL ===== */
.app-container {
    display: flex;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding-top: var(--header-height);
    transition: var(--transition);
}

.page-content {
    padding: 24px;
    max-width: 1400px;
    margin: 0 auto;
}

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--bg-sidebar);
    color: var(--texto-sidebar);
    z-index: 1000;
    overflow-y: auto;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.sidebar-header {
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    min-height: var(--header-height);
}

.sidebar-logo {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    object-fit: contain;
    background: #fff !important;
    border: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 700;
    font-size: 18px;
    flex-shrink: 0;
}

.sidebar-logo img {
    width: 100%;
    height: 100%;
    border-radius: 8px;
    object-fit: contain;
}

.sidebar-title {
    font-size: 16px;
    font-weight: 700;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-subtitle {
    font-size: 11px;
    color: var(--texto-sidebar);
    opacity: 0.7;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 0;
}

.sidebar-section {
    padding: 8px 20px 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(255, 255, 255, 0.4);
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    color: var(--texto-sidebar);
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background-color: var(--bg-sidebar-hover);
    color: #FFFFFF;
}

.sidebar-link.active {
    background-color: rgba(37, 99, 235, 0.15);
    color: #FFFFFF;
    border-left-color: var(--cor-primaria);
}

.sidebar-link i {
    width: 20px;
    text-align: center;
    font-size: 16px;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

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

.sidebar-user-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--cor-primaria);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 600;
    font-size: 14px;
    flex-shrink: 0;
}

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

.sidebar-user-name {
    font-size: 13px;
    font-weight: 600;
    color: #FFFFFF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar-user-role {
    font-size: 11px;
    color: var(--texto-sidebar);
}

/* ===== HEADER ===== */
.header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--borda);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    z-index: 999;
    transition: var(--transition);
}

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

.header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--texto-primario);
}

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

.btn-menu-mobile {
    display: none;
    background: none;
    border: none;
    font-size: 24px;
    color: var(--texto-primario);
    cursor: pointer;
}

/* ===== BOTÃO DARK MODE ===== */
.btn-theme {
    width: 40px;
    height: 40px;
    border: 1px solid var(--borda);
    border-radius: 8px;
    background-color: var(--bg-card);
    color: var(--texto-secundario);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    transition: var(--transition);
}

.btn-theme:hover {
    background-color: var(--bg-table-row-hover);
    color: var(--cor-primaria);
}

/* ===== PAGE HEADER ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header h1 {
    font-size: 24px;
    font-weight: 700;
    color: var(--texto-primario);
}

.page-header p {
    color: var(--texto-secundario);
    font-size: 14px;
    margin-top: 2px;
}

/* ===== CARDS ===== */
.cards-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--borda);
    padding: 18px;
    box-shadow: var(--sombra-card);
    transition: var(--transition);
    min-width: 0;
    overflow: hidden;
}

.card:hover {
    box-shadow: var(--sombra-card-hover);
}

.card-indicator {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.card-indicator .card-info {
    min-width: 0;
    flex: 1;
}

.card-indicator .card-info h3 {
    font-size: 11px;
    font-weight: 600;
    color: var(--texto-secundario);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-bottom: 8px;
    white-space: nowrap;
}

.card-indicator .card-info .card-value {
    font-size: clamp(16px, 1.8vw, 24px);
    font-weight: 800;
    color: var(--texto-primario);
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.card-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.card-icon.receita {
    background-color: var(--cor-sucesso-light);
    color: var(--cor-sucesso);
}

.card-icon.despesa {
    background-color: var(--cor-perigo-light);
    color: var(--cor-perigo);
}

.card-icon.lucro {
    background-color: var(--cor-primaria-light);
    color: var(--cor-primaria);
}

.card-icon.comissao {
    background-color: var(--cor-aviso-light);
    color: var(--cor-aviso);
}

.card-icon.medico {
    background-color: var(--cor-info-light);
    color: var(--cor-info);
}

/* ===== TABELAS ===== */
.table-container {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--borda);
    box-shadow: var(--sombra-card);
    overflow: hidden;
    margin-bottom: 24px;
}

.table-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--borda);
    flex-wrap: wrap;
    gap: 12px;
}

.table-header h2 {
    font-size: 16px;
    font-weight: 700;
    color: var(--texto-primario);
}

.table-responsive {
    overflow-x: auto;
}

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

table th {
    background-color: var(--bg-table-header);
    padding: 12px 16px;
    text-align: left;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--texto-secundario);
    border-bottom: 1px solid var(--borda);
    white-space: nowrap;
}

table td {
    padding: 12px 16px;
    font-size: 14px;
    color: var(--texto-primario);
    border-bottom: 1px solid var(--borda);
}

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

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

/* ============================
   Chat interno
   ============================ */
.chat-widget {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 9999;
    font-family: 'Inter', sans-serif;
}

.chat-toggle {
    width: 54px;
    height: 54px;
    border-radius: 16px;
    border: none;
    background: var(--cor-primaria);
    color: #fff;
    box-shadow: 0 10px 30px rgba(37, 99, 235, 0.3);
    cursor: pointer;
    position: relative;
}

.chat-badge {
    position: absolute;
    top: -6px;
    right: -6px;
    background: #ef4444;
    color: #fff;
    border-radius: 999px;
    padding: 2px 6px;
    font-size: 10px;
    font-weight: 700;
    min-width: 20px;
    text-align: center;
}

.chat-panel {
    position: fixed;
    right: 24px;
    bottom: 90px;
    width: 380px;
    max-width: calc(100vw - 48px);
    height: 520px;
    background: var(--bg-card);
    border: 1px solid var(--borda);
    border-radius: 18px;
    box-shadow: 0 18px 50px rgba(15, 23, 42, 0.2);
    display: none;
    overflow: hidden;
}

.chat-panel.open { display: block; }

.chat-header {
    background: var(--cor-primaria);
    color: #fff;
    padding: 12px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.chat-title {
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 8px;
}

.chat-close {
    background: transparent;
    border: none;
    color: #fff;
    cursor: pointer;
}

.chat-body {
    display: grid;
    grid-template-columns: 140px 1fr;
    height: calc(100% - 48px);
}

.chat-users {
    border-right: 1px solid var(--borda);
    background: var(--bg-table-header);
    display: flex;
    flex-direction: column;
}

.chat-users-header {
    padding: 10px 12px;
    font-size: 12px;
    font-weight: 700;
    color: var(--texto-secundario);
    border-bottom: 1px solid var(--borda);
}

.chat-users-list {
    overflow-y: auto;
}

.chat-user-item {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid var(--borda);
}

.chat-user-item:hover,
.chat-user-item.active {
    background: #e5efff;
}

.chat-user-avatar {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: #dbeafe;
    color: #1d4ed8;
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.chat-user-info {
    display: flex;
    flex-direction: column;
}

.chat-user-name {
    font-size: 12px;
    font-weight: 600;
    color: var(--texto-primario);
}

.chat-user-role {
    font-size: 10px;
    color: var(--texto-secundario);
}

.chat-messages {
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.chat-messages-header {
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    border-bottom: 1px solid var(--borda);
}

.chat-messages-list {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-height: 0;
}

.chat-msg {
    display: flex;
    flex-direction: column;
    max-width: 80%;
}

.chat-msg.me { align-self: flex-end; text-align: right; }
.chat-msg.them { align-self: flex-start; }

.chat-msg-bubble {
    padding: 10px 12px;
    border-radius: 14px;
    background: #e5efff;
    color: #1f2937;
    font-size: 12px;
    line-height: 1.4;
}

.chat-msg.me .chat-msg-bubble {
    background: #1d4ed8;
    color: #fff;
}

.chat-msg-time {
    font-size: 10px;
    color: var(--texto-secundario);
    margin-top: 4px;
}

.chat-input {
    border-top: 1px solid var(--borda);
    padding: 8px;
    display: flex;
    gap: 8px;
}

.chat-input input {
    flex: 1;
    border: 1px solid var(--borda);
    border-radius: 10px;
    padding: 8px;
    font-size: 12px;
}

.chat-send {
    border: none;
    background: var(--cor-primaria);
    color: #fff;
    border-radius: 10px;
    padding: 0 12px;
    cursor: pointer;
}

.btn.disabled {
    opacity: 0.5;
    pointer-events: none;
}

@media (max-width: 720px) {
    .chat-panel {
        right: 12px;
        left: 12px;
        width: auto;
        height: 70vh;
    }
    .chat-body { grid-template-columns: 120px 1fr; }
}

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 9999px;
    font-size: 12px;
    font-weight: 600;
    line-height: 1;
}

.badge-ativo {
    background-color: var(--cor-sucesso-light);
    color: var(--cor-sucesso);
}

.badge-inativo {
    background-color: var(--cor-perigo-light);
    color: var(--cor-perigo);
}

.badge-receita {
    background-color: var(--cor-sucesso-light);
    color: var(--cor-sucesso);
}

.badge-despesa {
    background-color: var(--cor-perigo-light);
    color: var(--cor-perigo);
}

.badge-admin {
    background-color: var(--cor-primaria-light);
    color: var(--cor-primaria);
}

.badge-medico {
    background-color: var(--cor-info-light);
    color: var(--cor-info);
}

/* ===== BOTÕES ===== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 20px;
    border: none;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background-color: var(--cor-primaria);
    color: #FFFFFF;
}

.btn-primary:hover {
    background-color: var(--cor-primaria-hover);
    color: #FFFFFF;
}

.btn-success {
    background-color: var(--cor-sucesso);
    color: #FFFFFF;
}

.btn-success:hover {
    background-color: #047857;
    color: #FFFFFF;
}

.btn-danger {
    background-color: var(--cor-perigo);
    color: #FFFFFF;
}

.btn-danger:hover {
    background-color: #B91C1C;
    color: #FFFFFF;
}

.btn-outline {
    background-color: transparent;
    border: 1px solid var(--borda);
    color: var(--texto-primario);
}

.btn-outline:hover {
    background-color: var(--bg-table-row-hover);
    color: var(--texto-primario);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
}

.btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius);
}

.btn-group {
    display: flex;
    gap: 6px;
}

/* ===== FORMULÁRIOS ===== */
.form-container {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--borda);
    box-shadow: var(--sombra-card);
    padding: 24px;
    margin-bottom: 24px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.form-group {
    margin-bottom: 16px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--texto-primario);
    margin-bottom: 6px;
}

.form-group label .required {
    color: var(--cor-perigo);
}

.form-control {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--borda-input);
    border-radius: var(--border-radius);
    font-size: 14px;
    color: var(--texto-primario);
    background-color: var(--bg-input);
    transition: var(--transition);
    font-family: inherit;
}

.form-control:focus {
    outline: none;
    border-color: var(--borda-input-focus);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

.form-control::placeholder {
    color: var(--texto-secundario);
    opacity: 0.7;
}

select.form-control {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid var(--borda);
}

/* ===== FILTROS ===== */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 16px 20px;
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--borda);
}

.filter-bar .form-group {
    margin-bottom: 0;
    min-width: 180px;
}

/* ===== GRÁFICOS ===== */
.charts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin-bottom: 24px;
}

.chart-card {
    background-color: var(--bg-card);
    border-radius: var(--border-radius);
    border: 1px solid var(--borda);
    box-shadow: var(--sombra-card);
    padding: 20px;
}

.chart-card h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--texto-primario);
    margin-bottom: 16px;
}

.chart-card canvas {
    max-height: 300px;
}

/* ===== ALERTAS / MENSAGENS ===== */
.alert {
    padding: 14px 18px;
    border-radius: var(--border-radius);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.alert-sucesso {
    background-color: var(--cor-sucesso-light);
    color: var(--cor-sucesso);
    border: 1px solid var(--cor-sucesso);
}

.alert-erro {
    background-color: var(--cor-perigo-light);
    color: var(--cor-perigo);
    border: 1px solid var(--cor-perigo);
}

.alert-aviso {
    background-color: var(--cor-aviso-light);
    color: var(--cor-aviso);
    border: 1px solid var(--cor-aviso);
}

.alert-info {
    background-color: var(--cor-info-light);
    color: var(--cor-info);
    border: 1px solid var(--cor-info);
}

/* ===== MODAL ===== */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 2000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-overlay.active {
    display: flex;
}

.modal {
    background-color: var(--bg-card);
    border-radius: 12px;
    box-shadow: var(--sombra-modal);
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

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

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--texto-secundario);
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background-color: var(--bg-table-row-hover);
}

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 16px 24px;
    border-top: 1px solid var(--borda);
}

/* ===== LOGIN ===== */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #1E3A5F 0%, #2563EB 100%);
    padding: 20px;
}

.login-card {
    background-color: var(--bg-card);
    border-radius: 16px;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.25);
    padding: 40px;
    width: 100%;
    max-width: 420px;
}

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

.login-header .login-logo {
    width: 60px;
    height: 60px;
    background: #fff !important;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 16px;
    color: white;
    font-size: 28px;
    font-weight: 800;
    border: 1px solid #e5e7eb;
}

.login-header h1 {
    font-size: 24px;
    font-weight: 800;
    color: var(--texto-primario);
    margin-bottom: 4px;
}

.login-header p {
    color: var(--texto-secundario);
    font-size: 14px;
}

.login-form .form-group {
    margin-bottom: 20px;
}

.login-form .btn {
    width: 100%;
    justify-content: center;
    padding: 12px;
    font-size: 15px;
}

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--texto-secundario);
}

.empty-state i {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--texto-primario);
}

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

/* ===== CONFIGURAÇÕES ===== */
.config-section {
    margin-bottom: 32px;
}

.config-section h3 {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--borda);
}

.color-preview {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 8px;
    border: 2px solid var(--borda);
    cursor: pointer;
}

.logo-preview {
    width: 120px;
    height: 120px;
    border: 2px dashed var(--borda);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 12px;
    overflow: hidden;
    background-color: var(--bg-table-row-hover);
}

.logo-preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* ===== UTILITÁRIOS ===== */
.text-success { color: var(--cor-sucesso) !important; }
.text-danger { color: var(--cor-perigo) !important; }
.text-warning { color: var(--cor-aviso) !important; }
.text-info { color: var(--cor-info) !important; }
.text-muted { color: var(--texto-secundario) !important; }
.text-right { text-align: right !important; }
.text-center { text-align: center !important; }
.text-bold { font-weight: 700 !important; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }
.d-flex { display: flex; }
.gap-2 { gap: 16px; }
.align-center { align-items: center; }
.justify-between { justify-content: space-between; }
.w-full { width: 100%; }

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

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }

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

    .main-content {
        margin-left: 0;
    }

    .header {
        left: 0;
    }

    .btn-menu-mobile {
        display: flex;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
    }

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

    .card-indicator .card-info .card-value {
        font-size: clamp(16px, 3vw, 22px);
    }

    .card-indicator .card-info h3 {
        font-size: 10px;
    }

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

    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .filter-bar .form-group {
        min-width: auto;
    }

    .table-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .form-actions {
        flex-direction: column;
    }

    .form-actions .btn {
        width: 100%;
        justify-content: center;
    }
}

@media (max-width: 480px) {
    .page-content {
        padding: 16px;
    }

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

    .card-indicator .card-info .card-value {
        font-size: 22px;
    }

    .login-card {
        padding: 24px;
    }

    .btn-group {
        flex-direction: column;
    }
}

/* ===== OVERLAY SIDEBAR MOBILE ===== */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

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

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

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--borda);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--texto-secundario);
}

/* ===== ANIMAÇÕES ===== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.animate-fade-in {
    animation: fadeIn 0.3s ease forwards;
}

/* ===== IMPRESSÃO ===== */
@media print {
    .sidebar,
    .header,
    .btn,
    .filter-bar {
        display: none !important;
    }

    .main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
    }

    .card {
        break-inside: avoid;
    }
}

/* Dropdown customizado de paciente */
.dropdown-custom .dropdown-list {
  background: #fff;
  color: #222;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  max-height: 220px;
  overflow-y: auto;
  width: 100%;
  padding: 0;
}
.dropdown-custom .dropdown-list input.form-control {
  background: #f9fafb;
  color: #222;
  border: 1px solid #e5e7eb;
  margin-bottom: 8px;
}
.dropdown-custom .item {
  color: #222;
  background: #fff;
  font-size: 15px;
  padding: 8px 12px;
  cursor: pointer;
  border-bottom: 1px solid #f3f4f6;
}
.dropdown-custom .item:last-child {
  border-bottom: none;
}
.dropdown-custom .item:hover {
  background: #e5e7eb;
  color: #111;
}

/* Dropdown multi-select (Tipo do agendamento) */
.dropdown-multi {
  position: relative;
}

.dropdown-multi-btn {
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.dropdown-multi-btn span {
  display: inline-block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dropdown-multi-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 1100;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  max-height: 220px;
  overflow-y: auto;
  padding: 6px;
}

.dropdown-multi-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  color: #111827;
}

.dropdown-multi-item:hover {
  background: #f3f4f6;
}

.dropdown-multi-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
}
