/* ─── Clinicom — App CSS ──────────────────────────────────────────────────── */
/* Premium fintech/BI aesthetic                                                 */

/* ── flatpickr — tema Clinicom ─────────────────────────────────────────────── */
.flatpickr-calendar {
    font-family: inherit;
    border: 1px solid #E6E1D8;
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.10);
}
.flatpickr-months .flatpickr-month,
.flatpickr-weekdays,
span.flatpickr-weekday {
    background: #2F6F5E;
    color: #fff;
    fill: #fff;
}
.flatpickr-current-month .flatpickr-monthDropdown-months,
.flatpickr-current-month input.cur-year {
    color: #fff;
}
.flatpickr-months .flatpickr-prev-month svg,
.flatpickr-months .flatpickr-next-month svg { fill: #fff; }
.flatpickr-day.selected,
.flatpickr-day.selected:hover {
    background: #2F6F5E;
    border-color: #2F6F5E;
    color: #fff;
}
.flatpickr-day:hover { background: #F0EEE8; }
.flatpickr-day.today { border-color: #2F6F5E; }
.flatpickr-time input:hover,
.flatpickr-time input:focus,
.flatpickr-time .flatpickr-am-pm:hover,
.flatpickr-time .flatpickr-am-pm:focus { background: #F7F5F0; }
.flatpickr-input.form-input[readonly] { background: #fff; cursor: pointer; }
.flatpickr-input.flatpickr-input ~ .form-input { background: #fff; cursor: pointer; }

/* ── Barra de controles do calendário ─────────────────────────────────────── */
.cal-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px 10px;
}
.cal-toolbar-title {
    font-size: 13px;
    font-weight: 600;
    color: #6B6B6B;
}
.cal-toolbar-actions {
    display: flex;
    gap: 4px;
}

/* ── Modo expandido (ocupa toda a área de conteúdo) ───────────────────────── */
.calendar-expanded {
    position: sticky;
    top: 16px;
    z-index: 100;
    box-shadow: 0 8px 32px rgba(0,0,0,.12);
}
.calendar-expanded #agenda-calendar {
    min-height: calc(100vh - 200px);
}

/* ── FullCalendar — botões no tema da aplicação ───────────────────────────── */
.fc .fc-button-primary {
    background-color: #2F6F5E;
    border-color: #2F6F5E;
    color: #fff;
    font-size: 12.5px;
    font-weight: 500;
    padding: 5px 11px;
    border-radius: 7px;
    box-shadow: none;
}
.fc .fc-button-primary:hover {
    background-color: #265e4f;
    border-color: #265e4f;
}
.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
    background-color: #1e4f43;
    border-color: #1e4f43;
}
.fc .fc-button-primary:focus {
    box-shadow: 0 0 0 3px rgba(47,111,94,.25);
}
.fc .fc-today-button {
    background-color: #B89B5E;
    border-color: #B89B5E;
}
.fc .fc-today-button:hover {
    background-color: #a08848;
    border-color: #a08848;
}
.fc-theme-standard .fc-scrollgrid { border-color: #E6E1D8; }
.fc-theme-standard td, .fc-theme-standard th { border-color: #E6E1D8; }
/* Cabeçalhos de colunas (Seg, Ter, ...) */
.fc .fc-col-header-cell-cushion { font-size: 12px; font-weight: 600; color: #6B6B6B; text-decoration: none; }
/* Números dos dias */
.fc .fc-daygrid-day-number { font-size: 12px; color: #6B6B6B; text-decoration: none; }
/* Dia atual */
.fc .fc-day-today { background: rgba(184,155,94,.07) !important; }
.fc .fc-day-today .fc-daygrid-day-number { color: #B89B5E; font-weight: 700; }
/* Título do calendário (mês/ano) */
.fc .fc-toolbar-title { font-size: 15px; font-weight: 600; color: #374151; }
/* Texto dos eventos */
.fc .fc-event-title { font-size: 11.5px; font-weight: 500; }
.fc .fc-daygrid-event { border-radius: 4px; }
/* Link "+N mais" */
.fc .fc-daygrid-more-link { font-size: 11px; color: #6B6B6B; }
/* List view — cabeçalho de dia */
.fc .fc-list-day-text, .fc .fc-list-day-side-text { color: #374151; font-size: 13px; }
.fc .fc-list-day-cushion { background: #F7F5F0; }
/* List view — linha de evento */
.fc .fc-list-event-title a { color: #374151; text-decoration: none; }
.fc .fc-list-event-time { color: #6B6B6B; font-size: 12px; }
/* Week/day view — labels de horário */
.fc .fc-timegrid-slot-label-cushion { font-size: 11px; color: #9CA3AF; }
/* Faixa "all-day" / "dia inteiro" — esconder label lateral */
.fc .fc-daygrid-body .fc-timegrid-axis { font-size: 11px; color: #9CA3AF; }
/* Mensagem lista vazia */
.fc .fc-list-empty-cushion { color: #9CA3AF; font-size: 13px; }

/* ── Tela cheia (Fullscreen API) ──────────────────────────────────────────── */
#calendar-card:fullscreen {
    background: #fff;
    padding: 16px;
    overflow-y: auto;
}
#calendar-card:fullscreen .cal-toolbar {
    padding: 0 0 12px;
}
#calendar-card:fullscreen #agenda-calendar {
    height: calc(100vh - 80px) !important;
}

/* Autocomplete de paciente (compartilhado em Leads, Orçamentos e Agenda) */
.patient-autocomplete {
    position: absolute;
    z-index: 200;
    background: #fff;
    border: 1px solid #E6E1D8;
    border-radius: 8px;
    box-shadow: 0 4px 16px rgba(0,0,0,.10);
    max-height: 220px;
    overflow-y: auto;
    min-width: 100%;
    top: calc(100% + 2px);
    left: 0;
}
.patient-ac-item {
    display: block;
    padding: 8px 14px;
    font-size: 13px;
    cursor: pointer;
    border-bottom: 1px solid #F3F0EA;
    color: inherit;
    text-decoration: none;
}
.patient-ac-item:last-child { border-bottom: none; }
.patient-ac-item:hover { background: #FAF8F5; }

:root {
    --cream:    #F7F5F0;
    --white:    #FFFFFF;
    --text:     #171717;
    --muted:    #6B6B6B;
    --border:   #E6E1D8;
    --gold:     #B89B5E;
    --green:    #2F6F5E;
    --red:      #B94A48;
    --graphite: #202124;
    --sidebar-w: 240px;
    --radius:   10px;
    --shadow:   0 1px 3px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
    --shadow-md: 0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.05);
}

* { box-sizing: border-box; }

body {
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    background-color: var(--cream);
    color: var(--text);
    line-height: 1.5;
}

/* ─── Sidebar ──────────────────────────────────────────────────────────────── */
.sidebar {
    background: var(--graphite);
    width: var(--sidebar-w);
    border-right: 1px solid rgba(255,255,255,.06);
    transition: width .2s ease;
}
/* Garante fundo grafite em todos os filhos diretos e área de scroll */
.sidebar > *,
.sidebar nav {
    background-color: var(--graphite);
}

/* Scrollbar discreto dentro da sidebar */
.sidebar nav {
    scrollbar-width: thin;
    scrollbar-color: rgba(255,255,255,.15) transparent;
}
.sidebar nav::-webkit-scrollbar        { width: 3px; }
.sidebar nav::-webkit-scrollbar-track  { background: transparent; }
.sidebar nav::-webkit-scrollbar-thumb  { background: rgba(255,255,255,.15); border-radius: 2px; }
.sidebar nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.28); }

/* ── Botão recolher ────────────────────────────────────────────────────────── */
.sidebar-collapse-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px; height: 28px;
    border-radius: 6px;
    background: none;
    border: none;
    color: rgba(255,255,255,.35);
    cursor: pointer;
    flex-shrink: 0;
    transition: color .15s, background .15s;
    margin-left: auto;
}
.sidebar-collapse-btn:hover { color: rgba(255,255,255,.75); background: rgba(255,255,255,.07); }
/* Chevron controlado por CSS (evita flash ao navegar) */
#sidebar-icon-expand { display: none; }
body.sidebar-collapsed #sidebar-icon-collapse { display: none; }
body.sidebar-collapsed #sidebar-icon-expand   { display: block; }

/* ── Modo recolhido ────────────────────────────────────────────────────────── */
body.sidebar-collapsed .sidebar            { width: 56px; }
body.sidebar-collapsed .sidebar-logo-text,
body.sidebar-collapsed .sidebar-section-label,
body.sidebar-collapsed .sidebar-link-label,
body.sidebar-collapsed .sidebar-user-name,
body.sidebar-collapsed .sidebar-user-role  { display: none; }
/* Recolhido: logo (sem texto) em cima e o chevron de expandir logo abaixo */
body.sidebar-collapsed .sidebar-logo-mark  { cursor: pointer; }
body.sidebar-collapsed .sidebar-logo       { padding: 12px 10px; }
body.sidebar-collapsed .sidebar-logo > div { flex-direction: column; align-items: center; gap: 8px; }
body.sidebar-collapsed nav                 { padding-left: 8px; padding-right: 8px; }
body.sidebar-collapsed .sidebar-link       { justify-content: center; padding: 9px 0; }
body.sidebar-collapsed .sidebar-link-icon  { width: 36px; margin: 0 auto; opacity: .8; }
body.sidebar-collapsed .sidebar-user       { justify-content: center; padding: 14px 0; gap: 0; }
body.sidebar-collapsed .sidebar-user-avatar{ margin: 0; }
body.sidebar-collapsed .sidebar-collapse-btn { margin: 0; }

/* Tooltip dos ícones da sidebar (posicionado via JS no body) */
#sidebar-tooltip {
    position: fixed;
    background: #1a1a1a;
    color: #fff;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    padding: 5px 10px;
    border-radius: 6px;
    pointer-events: none;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(0,0,0,.25);
    display: none;
}
body.sidebar-collapsed #main-wrap          { margin-left: 56px; transition: margin-left .2s ease; }
#main-wrap                                 { transition: margin-left .2s ease; }

.sidebar-logo {
    padding: 20px 16px 16px;
    border-bottom: 1px solid rgba(255,255,255,.06);
    overflow: hidden;
}

.sidebar-logo-icon {
    width: 36px; height: 36px;
    border-radius: 9px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
    overflow: hidden;
}
.sidebar-logo-icon img { width: 100%; height: 100%; display: block; object-fit: cover; }

.sidebar-logo-name {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    letter-spacing: -.02em;
}

.sidebar-logo-tagline {
    font-size: 10px;
    color: rgba(255,255,255,.4);
    letter-spacing: .02em;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: rgba(184,155,94,.6);
    padding: 16px 12px 6px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 7px;
    font-size: 13.5px;
    font-weight: 450;
    color: rgba(245,242,236,.6);
    text-decoration: none;
    transition: all .15s ease;
    margin-bottom: 1px;
}

.sidebar-link:hover {
    background: rgba(184,155,94,.10);
    color: #F5F2EC;
}

.sidebar-link.active {
    background: rgba(184,155,94,.16);
    color: var(--gold);
}

/* Ícones em branco (seguem a cor do texto); ativo em dourado */
.sidebar-link.active .sidebar-link-icon svg { stroke: var(--gold); }

.sidebar-link-icon {
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    opacity: .7;
    flex-shrink: 0;
}

.sidebar-link.active .sidebar-link-icon { opacity: 1; }
.sidebar-link:hover .sidebar-link-icon  { opacity: .9; }

.sidebar-user {
    border-top: 1px solid rgba(255,255,255,.06);
    padding: 14px 16px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.sidebar-user-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--gold);
    display: flex; align-items: center; justify-content: center;
    color: white;
    font-size: 12px;
    font-weight: 600;
    flex-shrink: 0;
    overflow: hidden;
    position: relative;
}
.sidebar-user-avatar img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.sidebar-user-avatar .sidebar-user-initial {
    display: none;            /* exibido via onerror quando não há foto */
    width: 100%; height: 100%;
    align-items: center; justify-content: center;
}

.sidebar-user-name  { font-size: 13px; font-weight: 500; color: rgba(255,255,255,.85); }
.sidebar-user-role  { font-size: 11px; color: rgba(255,255,255,.4); }

.sidebar-logout {
    background: none; border: none; cursor: pointer;
    color: rgba(255,255,255,.35);
    padding: 4px;
    border-radius: 5px;
    transition: color .15s;
}
.sidebar-logout:hover { color: var(--red); }

/* ─── Topbar ───────────────────────────────────────────────────────────────── */
.topbar {
    height: 60px;
    min-height: 60px;
    flex-shrink: 0;            /* não deixa o flex comprimir o topbar em páginas longas */
    background: var(--white);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 32px;
    gap: 20px;
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left  { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; }
.topbar-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; }
.topbar-logo  { height: 34px; max-width: 140px; object-fit: contain; flex-shrink: 0; border-radius: 4px; }

.topbar-clinic-name { font-size: 13px; font-weight: 600; color: var(--text); }
.topbar-divider     { color: var(--border); margin: 0 6px; }
.topbar-page-title  { font-size: 13px; color: var(--muted); }

.topbar-meta-status {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
}
.topbar-meta-status.connected    { background: #e8f5f0; color: var(--green); }
.topbar-meta-status.disconnected { background: #fef3f2; color: #b91c1c; }
/* Pill clicável (conectar/reconectar via login do Facebook) */
button.topbar-meta-status { border: none; cursor: pointer; font-family: inherit; transition: filter .15s, background .15s; }
button.topbar-meta-status:hover { filter: brightness(.97); }
.topbar-meta-status.is-cta { background: #FFF7ED; color: #B45309; }
.topbar-meta-status.is-cta:hover { background: #FEEBC8; filter: none; }

.topbar-period { display: flex; align-items: center; gap: 8px; }
.topbar-period-label { font-size: 12px; color: var(--muted); }
.topbar-period-input {
    font-family: inherit;
    font-size: 12px;
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 5px 8px;
    background: var(--cream);
    outline: none;
    transition: border-color .15s;
}
.topbar-period-input:focus { border-color: var(--gold); }

.status-dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}

/* ─── Diagnostic Button ────────────────────────────────────────────────────── */
.btn-diagnostic {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 14px;
    background: var(--graphite);
    color: var(--gold);
    border: 1px solid rgba(184,155,94,.3);
    border-radius: 7px;
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s ease;
}
.btn-diagnostic:hover { background: #2d3035; border-color: var(--gold); }

/* ─── Flash Messages ───────────────────────────────────────────────────────── */
.flash-message {
    position: fixed;
    top: 24px;
    left: 50%;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    min-width: 300px;
    max-width: min(92vw, 460px);
    padding: 15px 18px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 12px;
    border: 1px solid var(--border);
    border-left-width: 4px;
    box-shadow: 0 14px 38px rgba(0, 0, 0, .20);
    overflow: hidden;
    animation: flashIn .3s cubic-bezier(.2, .8, .2, 1);
}

@keyframes flashIn {
    from { transform: translate(-50%, -28px); opacity: 0; }
    to   { transform: translate(-50%, 0);      opacity: 1; }
}

.flash-message { transform: translateX(-50%); }
.flash-message.flash-out { animation: flashOut .25s ease forwards; }
@keyframes flashOut {
    from { transform: translate(-50%, 0);    opacity: 1; }
    to   { transform: translate(-50%, -18px); opacity: 0; }
}

.flash-content { display: flex; align-items: center; gap: 11px; }
.flash-icon    { width: 20px; height: 20px; flex-shrink: 0; }
.flash-text    { line-height: 1.35; }
.flash-close   { background: none; border: none; cursor: pointer; opacity: .5; padding: 2px; color: inherit; flex-shrink: 0; }
.flash-close:hover { opacity: 1; }

/* Barra de progresso do tempo de exibição */
.flash-progress {
    position: absolute; left: 0; bottom: 0; height: 3px; width: 100%;
    background: currentColor; opacity: .35; transform-origin: left;
    animation: flashProgress linear forwards;
}
@keyframes flashProgress { from { transform: scaleX(1); } to { transform: scaleX(0); } }

.flash-success { background: #ecfdf5; border-color: #a7f3d0; border-left-color: #10b981; color: #065f46; }
.flash-error   { background: #fef2f2; border-color: #fca5a5; border-left-color: #ef4444; color: #991b1b; }
.flash-warning { background: #fffbeb; border-color: #fcd34d; border-left-color: #f59e0b; color: #92400e; }
.flash-info    { background: #eff6ff; border-color: #bfdbfe; border-left-color: #3b82f6; color: #1e40af; }

/* ─── Page Layout ──────────────────────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 20px;
}
.page-title    { font-size: 22px; font-weight: 650; letter-spacing: -.03em; color: var(--text); }
.page-subtitle { font-size: 13.5px; color: var(--muted); margin-top: 3px; }

.breadcrumb-link {
    font-size: 12.5px; color: var(--muted);
    text-decoration: none;
    display: inline-flex; align-items: center; gap: 4px;
}
.breadcrumb-link:hover { color: var(--text); }

/* ─── Cards ────────────────────────────────────────────────────────────────── */
.card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 18px 22px 14px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}

.card-title    { font-size: 14.5px; font-weight: 600; color: var(--text); }
.card-subtitle { font-size: 12px; color: var(--muted); margin-top: 2px; }
.card-action   { font-size: 12.5px; color: var(--gold); text-decoration: none; font-weight: 500; }
.card-action:hover { text-decoration: underline; }
.card-body     { padding: 18px 22px; }

/* ─── KPI Cards ─────────────────────────────────────────────────────────────── */
.kpi-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.kpi-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

@media (max-width: 1200px) { .kpi-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px)  { .kpi-grid-4, .kpi-grid-3 { grid-template-columns: 1fr; } }

.kpi-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    transition: box-shadow .15s ease;
}
.kpi-card:hover { box-shadow: var(--shadow-md); }

.kpi-card-highlight {
    border-color: rgba(184,155,94,.3);
    background: linear-gradient(135deg, #fdfbf5 0%, #fdfbf7 100%);
}
.kpi-card-profit {
    border-color: rgba(47,111,94,.2);
    background: linear-gradient(135deg, #f4faf8 0%, #f6faf9 100%);
}

/* Cards com dados dos dois módulos (financeiro + Meta Ads) */
.kpi-card-mixed {
    background: linear-gradient(135deg, #fef0cc 0%, #dff2ea 100%);
    border-color: rgba(140, 130, 80, 0.55);
}
.kpi-card-profit.kpi-card-mixed {
    background: linear-gradient(135deg, #fdefc8 0%, #d8f0e4 100%);
    border-color: rgba(140, 130, 80, 0.6);
}

/* Meta Ads cards — âmbar/dourado suave */
.kpi-card-meta {
    background: #fdf6e8;
    border-color: rgba(184, 155, 94, 0.4);
}
.kpi-card-highlight.kpi-card-meta {
    background: linear-gradient(135deg, #fdf8ec 0%, #fdf4e0 100%);
    border-color: rgba(184, 155, 94, 0.45);
}

/* Financial cards — verde saturado */
.kpi-card-finance {
    background: #d8f0e8;
    border-color: rgba(47, 111, 94, 0.55);
}
.kpi-card-profit.kpi-card-finance {
    background: linear-gradient(135deg, #ccecdf 0%, #d8f0e8 100%);
    border-color: rgba(47, 111, 94, 0.6);
}

.kpi-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}
.kpi-label   { font-size: 11.5px; font-weight: 500; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi-value   { font-size: 26px; font-weight: 650; letter-spacing: -.03em; color: var(--text); line-height: 1; }
.kpi-value-roi { color: var(--gold); }
.kpi-sub     { font-size: 11.5px; color: var(--muted); margin-top: 6px; }

.kpi-icon {
    width: 28px; height: 28px;
    border-radius: 7px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.kpi-icon-gold    { background: rgba(184,155,94,.12); color: var(--gold); }
.kpi-icon-green   { background: rgba(47,111,94,.1);  color: var(--green); }
.kpi-icon-red     { background: rgba(185,74,72,.1);  color: var(--red); }
.kpi-icon-neutral { background: rgba(0,0,0,.05); color: var(--muted); }

/* ─── Badges ───────────────────────────────────────────────────────────────── */
.badge {
    display: inline-flex; align-items: center;
    padding: 2px 8px;
    border-radius: 20px;
    font-size: 11px; font-weight: 600;
    white-space: nowrap;
}
.kpi-badge   { @extend .badge; }

.badge-success  { background: #ecfdf5; color: #065f46; }
.badge-warning  { background: #fffbeb; color: #92400e; }
.badge-critical { background: #fef2f2; color: #991b1b; }
.badge-info     { background: #eff6ff; color: #1e40af; }
.badge-neutral  { background: #f4f4f5; color: #52525b; }

/* ─── ROI Badges ───────────────────────────────────────────────────────────── */
.roi-badge {
    display: inline-flex;
    padding: 3px 8px;
    border-radius: 5px;
    font-size: 12px; font-weight: 600;
}
.roi-excellent { background: #ecfdf5; color: #065f46; }
.roi-ok        { background: #fffbeb; color: #92400e; }
.roi-poor      { background: #fef2f2; color: #991b1b; }

/* ─── Data Table ───────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table thead tr { border-bottom: 1px solid var(--border); }
.data-table th {
    padding: 11px 16px;
    font-size: 11px; font-weight: 600;
    text-transform: uppercase; letter-spacing: .06em;
    color: var(--muted);
    text-align: left;
    white-space: nowrap;
    background: var(--cream);
}
.data-table th.text-right  { text-align: right; }
.data-table th.text-center { text-align: center; }
.data-table td {
    padding: 13px 16px;
    font-size: 13.5px;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
}
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover td { background: #fafaf8; }
.data-table .row-attention td { background: #fffbeb !important; }
/* Linha de totais agregados, fixada logo abaixo do cabeçalho */
.data-table thead .row-totals td {
    padding: 10px 16px;
    font-size: 13px; font-weight: 700;
    color: var(--graphite);
    background: var(--cream);
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}
.text-secondary { color: var(--muted); }
.text-right { text-align: right; }
.text-center { text-align: center; }

/* ─── Buttons ───────────────────────────────────────────────────────────────── */
.btn-primary {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 9px 18px;
    background: var(--graphite); color: #fff;
    border: none; border-radius: 8px;
    font-family: inherit; font-size: 13.5px; font-weight: 500;
    cursor: pointer; text-decoration: none;
    transition: all .15s ease;
    white-space: nowrap;
}
.btn-primary:hover { background: #2d3035; }

.btn-primary.btn-entrada { background: var(--green); }
.btn-primary.btn-entrada:hover { background: #27604f; }
.btn-primary.btn-saida { background: var(--red); }
.btn-primary.btn-saida:hover { background: #a33f3d; }

/* ─── Diálogo de confirmação estilizado (substitui o confirm() nativo) ───── */
.cdlg-overlay {
    position: fixed; inset: 0; z-index: 10000;
    background: rgba(23, 23, 23, .45);
    display: flex; align-items: center; justify-content: center;
    padding: 20px; opacity: 0; transition: opacity .16s ease;
}
.cdlg-overlay.is-open { opacity: 1; }
.cdlg {
    background: #fff; border-radius: 16px; width: 100%; max-width: 400px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .28); padding: 26px 24px 22px;
    text-align: center;
    transform: translateY(10px) scale(.97);
    transition: transform .2s cubic-bezier(.2, .8, .2, 1);
}
.cdlg-overlay.is-open .cdlg { transform: translateY(0) scale(1); }
.cdlg-icon {
    width: 54px; height: 54px; border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    margin: 0 auto 16px; background: #fdecea; color: var(--red);
}
.cdlg-icon.is-info { background: rgba(47, 111, 94, .12); color: var(--green); }
.cdlg-title { font-size: 16.5px; font-weight: 700; color: var(--text); margin-bottom: 6px; }
.cdlg-message { font-size: 14px; color: var(--muted); line-height: 1.55; white-space: pre-line; }
.cdlg-actions { display: flex; gap: 10px; margin-top: 24px; }
.cdlg-actions button {
    flex: 1; padding: 11px 14px; border-radius: 10px;
    font-family: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
    border: 1px solid var(--border); transition: background .14s, border-color .14s;
}
.cdlg-cancel { background: #fff; color: var(--text); }
.cdlg-cancel:hover { background: var(--cream); border-color: #c8c2b8; }
.cdlg-confirm { background: var(--graphite); color: #fff; border-color: transparent; }
.cdlg-confirm:hover { background: #2d3035; }
.cdlg-confirm.is-danger { background: var(--red); }
.cdlg-confirm.is-danger:hover { background: #a33f3d; }

/* Evento de Tarefa no calendário (all-day) */
.fc-evt-task { font-size: 11px; font-weight: 600; padding: 1px 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #5b4708; }
.fc-daygrid-event .fc-evt-task, .fc-timegrid-event .fc-evt-task { color: #5b4708 !important; }

/* Botões rápidos de "marcar como pago/recebido" na timeline de lançamentos */
.btn-action.fin-pay-revenue { background: var(--green); color: #fff; }
.btn-action.fin-pay-revenue:hover { background: #27604f; color: #fff; }
.btn-action.fin-pay-expense { background: var(--red); color: #fff; }
.btn-action.fin-pay-expense:hover { background: #a33f3d; color: #fff; }

/* Texto de item já consumido (produto travado) — mesmo cinza escuro da execução */
.cp-locked-text { color: var(--text); font-size: 12px; }
tr.cp-locked td { padding-top: 8px; padding-bottom: 8px; }

/* ─── Timeline de lançamentos (collapse por dia) ─────────────────────────── */
.fin-timeline { display: flex; flex-direction: column; }
/* Ícone de ajuda com tooltip instantâneo (?) */
.help-tip {
    display: inline-flex; align-items: center; justify-content: center;
    width: 15px; height: 15px; border-radius: 50%; background: var(--border); color: #6B6B6B;
    font-size: 10px; font-weight: 700; cursor: help; position: relative; margin-left: 5px; vertical-align: middle;
}
.help-tip::after {
    content: attr(data-tip);
    position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
    background: #171717; color: #fff; font-size: 11px; font-weight: 500; line-height: 1.3;
    padding: 7px 9px; border-radius: 6px; width: 200px; white-space: normal; text-align: center;
    opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 60;
}
.help-tip:hover::after { opacity: 1; }

/* Filtro de período (chips) */
.range-filter { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.range-chip {
    padding: 6px 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--white);
    font-size: 13px; font-weight: 600; color: var(--muted); text-decoration: none; transition: all .12s;
}
.range-chip:hover { border-color: var(--green); color: var(--green); }
.range-chip.is-active { background: var(--green); border-color: var(--green); color: #fff; }

/* Stepper de quantidade (− / +) — usado em orçamento e execução */
.qty-stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; height: 38px; }
.qty-stepper .qty-btn {
    width: 30px; border: none; background: #F7F5F0; color: #4B4B4B;
    font-size: 16px; font-weight: 600; cursor: pointer; line-height: 1; padding: 0;
    display: flex; align-items: center; justify-content: center; transition: background .12s;
}
.qty-stepper .qty-btn:hover { background: #ECE8E0; color: var(--text); }
.qty-stepper input {
    width: 48px; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border);
    text-align: center; font-size: 14px; font-family: inherit; color: var(--text); outline: none; padding: 0;
}
/* Variante compacta (tabela de execução) */
.qty-stepper--sm { height: 32px; }
.qty-stepper--sm .qty-btn { width: 26px; font-size: 15px; }
.qty-stepper--sm input { width: 36px; font-size: 13px; }

/* Stepper genérico (− / +) aplicado automaticamente a inputs numéricos */
.num-stepper { display: inline-flex; align-items: stretch; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; height: 38px; vertical-align: middle; width: fit-content; max-width: 100%; }
.num-stepper .num-stepper-btn {
    width: 30px; border: none; background: #F7F5F0; color: #4B4B4B;
    font-size: 16px; font-weight: 600; cursor: pointer; line-height: 1; padding: 0;
    display: flex; align-items: center; justify-content: center; transition: background .12s;
}
.num-stepper .num-stepper-btn:hover { background: #ECE8E0; color: var(--text); }
.num-stepper input {
    width: 56px; border: none; border-left: 1px solid var(--border); border-right: 1px solid var(--border);
    text-align: center; font-size: 14px; font-family: inherit; color: var(--text); outline: none; padding: 0; background: #fff;
}
.num-stepper input::-webkit-outer-spin-button,
.num-stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num-stepper input[type=number] { -moz-appearance: textfield; }

.fin-totals-bar { display: flex; gap: 12px; }
.fin-total-item {
    flex: 1; display: flex; flex-direction: column; gap: 4px;
    background: var(--white); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px;
}
.fin-total-lbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.fin-total-val { font-size: 19px; font-weight: 700; color: var(--text); }
@media (max-width: 560px) { .fin-totals-bar { flex-direction: column; } }
.fin-day { border: 1px solid var(--border); border-radius: 10px; margin-bottom: 10px; background: var(--white); overflow: hidden; }
.fin-day.is-empty { opacity: .55; }
.fin-day-header { display: flex; align-items: center; gap: 18px; padding: 14px 18px; }
.fin-day.has-tx > .fin-day-header { cursor: pointer; }
.fin-day.has-tx > .fin-day-header:hover { background: var(--cream); }
.fin-day-badge {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-width: 46px; line-height: 1.1;
}
.fin-day-num { font-size: 20px; font-weight: 700; color: var(--text); }
.fin-day-mon { font-size: 10px; font-weight: 600; letter-spacing: .5px; color: var(--muted); }
.fin-day-name { font-size: 14px; font-weight: 600; color: var(--text); }
.fin-today { font-size: 10px; font-weight: 600; color: var(--green); background: rgba(47,111,94,.1); padding: 2px 7px; border-radius: 10px; margin-left: 8px; }
.fin-day-summary { margin-left: auto; display: flex; gap: 28px; align-items: center; }
.fin-sum { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.3; }
.fin-sum-lbl { font-size: 11px; color: var(--muted); }
.fin-sum-val { font-size: 14px; font-weight: 600; }
.fin-green { color: var(--green); }
.fin-red   { color: var(--red); }
.fin-chevron { color: var(--muted); transition: transform .18s ease; display: flex; }
.fin-day.is-open .fin-chevron { transform: rotate(180deg); }
.fin-day-body { display: none; border-top: 1px solid var(--border); padding: 4px 18px 8px; background: var(--cream); }
.fin-day.is-open .fin-day-body { display: block; }
.fin-tx { display: flex; align-items: center; gap: 14px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.fin-tx:last-child { border-bottom: none; }
.fin-tx-time { color: var(--muted); font-size: 12.5px; min-width: 42px; }
.fin-tx-type { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 10px; min-width: 60px; text-align: center; }
.fin-tx-type-revenue { color: var(--green); background: rgba(47,111,94,.1); }
.fin-tx-type-expense { color: var(--red);   background: rgba(185,74,72,.1); }
.fin-tx-type-receivable { color: #B45309; background: rgba(217,119,6,.12); min-width: 84px; }
.fin-tx-type-sale { color: #6B4FA0; background: rgba(124,58,237,.12); }
.fin-tx-type-payable { color: #B91C1C; background: rgba(220,38,38,.10); min-width: 84px; }
.fin-tx-inst { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 600; color: #9A968C; }

/* Venda = cabeçalho do grupo; os lançamentos dela ficam indentados abaixo. */
.fin-tx--sale  { background: rgba(124,58,237,.035); }
.fin-tx--sale .fin-tx-desc { font-weight: 600; }
.fin-tx--child { padding-left: 26px; position: relative; }
/* Traço vertical ligando o filho ao grupo da venda */
.fin-tx--child::before {
    content: '';
    position: absolute;
    left: 10px; top: 0; bottom: 0;
    border-left: 2px solid rgba(124,58,237,.22);
}
.fin-tx--child .fin-tx-desc { font-weight: 400; }
/* Linha da taxa de maquininha: detalhamento da entrada, não conta no total do dia */
.fin-tx--fee { opacity: .72; }
.fin-tx--fee .fin-tx-desc,
.fin-tx--fee .fin-tx-val { font-style: italic; font-weight: 400; }
@media (max-width: 640px) {
    .fin-tx--child { padding-left: 14px; }
    .fin-tx--child::before { left: 4px; }
}
.fin-tx-desc { font-weight: 500; color: var(--text); flex: 1; min-width: 120px; }
.fin-tx-cat { color: var(--muted); font-size: 12.5px; }
.fin-tx-val { font-weight: 600; text-align: right; min-width: 96px; }
.fin-tx-status { font-size: 11px; }
.fin-tx-actions { display: flex; gap: 4px; }
@media (max-width: 640px) {
    .fin-tx-cat { display: none; }
    .fin-day-summary { gap: 16px; }
}

.btn-secondary {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 16px;
    background: var(--white); color: var(--text);
    border: 1px solid var(--border); border-radius: 8px;
    font-family: inherit; font-size: 13px; font-weight: 500;
    cursor: pointer; text-decoration: none;
    transition: all .15s ease;
    white-space: nowrap;
}
.btn-secondary:hover { border-color: #c8c2b8; background: var(--cream); }

.btn-ghost {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 8px 14px;
    background: transparent; color: var(--muted);
    border: none; border-radius: 8px;
    font-family: inherit; font-size: 13px; font-weight: 500;
    cursor: pointer; text-decoration: none;
    transition: all .15s ease;
}
.btn-ghost:hover { background: var(--border); color: var(--text); }

.btn-action {
    display: inline-flex; align-items: center; justify-content: center;
    width: 28px; height: 28px;
    background: none; color: var(--muted);
    border: 1px solid var(--border); border-radius: 6px;
    cursor: pointer; text-decoration: none;
    transition: all .15s ease;
}
.btn-action:hover        { background: var(--cream); color: var(--text); border-color: #c8c2b8; }
.btn-action-primary:hover { background: rgba(47,111,94,.08); color: var(--green); border-color: var(--green); }
.btn-action-danger:hover  { background: #fef2f2; color: var(--red); border-color: var(--red); }
.btn-action-warning:hover { background: #fffbeb; color: #92400e; border-color: #fcd34d; }
.btn-action-success:hover { background: #ecfdf5; color: #065f46; border-color: #a7f3d0; }
.btn-action-view:hover    { background: rgba(184,155,94,.1); color: var(--gold); border-color: var(--gold); }

/* ─── Admin Viewing Bar ─────────────────────────────────────────────────────── */
.admin-viewing-bar {
    display: flex; align-items: center; gap: 8px;
    flex-shrink: 0;
    background: rgba(184,155,94,.12);
    border-bottom: 1px solid rgba(184,155,94,.3);
    padding: 8px 24px;
    font-size: 13px;
    color: #7a6030;
}
.admin-viewing-bar strong { color: #5a4520; }
.admin-viewing-leave {
    margin-left: auto;
    color: var(--gold);
    font-weight: 500;
    text-decoration: none;
    font-size: 12px;
}
.admin-viewing-leave:hover { text-decoration: underline; }

/* ─── Filter Bar ────────────────────────────────────────────────────────────── */
.filter-bar {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    box-shadow: var(--shadow);
}
.filter-form  { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.filter-group { display: flex; align-items: center; gap: 8px; }
.filter-label { font-size: 12px; font-weight: 500; color: var(--muted); white-space: nowrap; }
.filter-select, .filter-input {
    font-family: inherit; font-size: 13px; color: var(--text);
    background: var(--cream);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 6px 10px;
    outline: none;
    transition: border-color .15s;
}
.filter-select:focus, .filter-input:focus { border-color: var(--gold); }

/* ─── Forms ─────────────────────────────────────────────────────────────────── */
.form-group   { display: flex; flex-direction: column; }
.form-label   {
    font-size: 12.5px; font-weight: 500; color: var(--text);
    margin-bottom: 6px;
}
.form-required { color: var(--red); }
.form-hint    { font-size: 11.5px; color: var(--muted); margin-top: 4px; }

.form-input, .form-select, .form-textarea {
    font-family: inherit; font-size: 13.5px; color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    outline: none;
    transition: border-color .15s, box-shadow .15s;
    width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(184,155,94,.1);
}
.form-input.is-invalid, .form-select.is-invalid {
    border-color: var(--red);
}

.form-textarea { resize: vertical; min-height: 80px; }
.form-section-title {
    font-size: 13px; font-weight: 600;
    color: var(--muted);
    padding-bottom: 10px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    text-transform: uppercase; letter-spacing: .04em;
}
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; padding-top: 8px; }

.field-error  { font-size: 12px; color: var(--red); margin-top: 4px; }

/* ─── Modal ─────────────────────────────────────────────────────────────────── */
.modal-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,.45);
    display: flex; align-items: center; justify-content: center;
    z-index: 100;
    padding: 16px;
    animation: fadeIn .15s ease;
}
.modal-overlay--hidden { display: none !important; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
    background: var(--white);
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
    width: 100%; max-width: 560px;
    max-height: 90vh; overflow-y: auto;
    animation: slideUp .2s ease;
}
.modal-sm { max-width: 400px; }

@keyframes slideUp {
    from { transform: translateY(20px); opacity: 0; }
    to   { transform: translateY(0);    opacity: 1; }
}

.modal-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 18px 22px;
    border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 600; }
.modal-close {
    background: none; border: none; cursor: pointer;
    color: var(--muted); padding: 4px; border-radius: 5px;
    transition: all .15s;
}
.modal-close:hover { background: var(--cream); color: var(--text); }
.modal-body   { padding: 22px; }
.modal-footer { padding: 16px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 10px; }

/* ─── Empty States ───────────────────────────────────────────────────────────── */
.empty-state {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    padding: 60px 24px;
    text-align: center;
}
.empty-state-icon { width: 56px; height: 56px; border-radius: 16px; background: var(--cream); display: flex; align-items: center; justify-content: center; color: var(--border); margin-bottom: 16px; }
.empty-state-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.empty-state-text  { font-size: 13.5px; color: var(--muted); max-width: 320px; margin-bottom: 20px; }
.empty-state-sm { padding: 24px; text-align: center; color: var(--muted); font-size: 13px; }

/* ─── Top Ad Items ───────────────────────────────────────────────────────────── */
.top-ad-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.top-ad-item:last-child { border-bottom: none; }
.top-ad-rank { width: 20px; height: 20px; font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; flex-shrink: 0; }
.top-ad-info { flex: 1; min-width: 0; }
.top-ad-name { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-ad-meta { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.top-ad-roi  { font-size: 14px; font-weight: 700; flex-shrink: 0; }

/* ─── Diagnostic Banner ─────────────────────────────────────────────────────── */
.diagnostic-banner {
    background: var(--graphite);
    border-radius: var(--radius);
    padding: 20px 24px;
}
.diagnostic-banner-empty { background: var(--white); border: 1px dashed var(--border); }
.diagnostic-banner-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.diagnostic-banner-icon {
    width: 40px; height: 40px; border-radius: 10px;
    background: rgba(184,155,94,.2); color: var(--gold);
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.diagnostic-banner-icon-empty { color: var(--muted); }
.diagnostic-banner-title { font-size: 15px; font-weight: 600; color: #fff; }
.diagnostic-banner-empty .diagnostic-banner-title { color: var(--text); }
.diagnostic-banner-subtitle { font-size: 12.5px; color: rgba(255,255,255,.5); }
.diagnostic-banner-empty .diagnostic-banner-subtitle { color: var(--muted); }
.diagnostic-banner-link {
    margin-left: auto; font-size: 12.5px;
    color: var(--gold); text-decoration: none;
    white-space: nowrap;
}
.diagnostic-findings-preview { display: flex; flex-wrap: wrap; gap: 8px; }
.finding-chip {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 5px 10px; border-radius: 20px;
    font-size: 12px; font-weight: 500;
}
.finding-chip-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.finding-chip-critical { background: rgba(185,74,72,.2); color: #f87171; }
.finding-chip-warning  { background: rgba(251,191,36,.15); color: #fbbf24; }
.finding-chip-info     { background: rgba(96,165,250,.15); color: #60a5fa; }
.finding-chip-neutral  { background: rgba(255,255,255,.1); color: rgba(255,255,255,.5); }

/* ─── Diagnostic Cards ──────────────────────────────────────────────────────── */
.diagnostic-featured-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 28px;
    box-shadow: var(--shadow-md);
}
.diag-featured-header {
    display: flex; align-items: flex-start; gap: 20px;
    margin-bottom: 24px;
}
.diag-featured-title .diag-featured-label {
    font-size: 11px; font-weight: 600; text-transform: uppercase;
    letter-spacing: .06em; color: var(--gold);
}
.diag-featured-title h2 { font-size: 20px; font-weight: 650; margin-top: 4px; }
.diag-score-ring {
    width: 72px; height: 72px; border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    flex-shrink: 0;
    border: 3px solid;
    margin-left: auto;
}
.diag-score-ring.score-excellent { border-color: var(--green); color: var(--green); }
.diag-score-ring.score-good      { border-color: #16a34a;      color: #16a34a; }
.diag-score-ring.score-warning   { border-color: #d97706;      color: #d97706; }
.diag-score-ring.score-critical  { border-color: var(--red);   color: var(--red); }
.diag-score-value { font-size: 22px; font-weight: 700; line-height: 1; }
.diag-score-label { font-size: 10px; font-weight: 500; opacity: .7; }

.diag-findings-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.diag-finding-card {
    border-radius: 8px; padding: 16px;
    border: 1px solid;
}
.diag-finding-critical { background: #fff; border-color: #E6E1D8; border-left: 3px solid #171717; }
.diag-finding-warning  { background: #fff; border-color: #E6E1D8; border-left: 3px solid #B89B5E; }
.diag-finding-info     { background: #fff; border-color: #E6E1D8; border-left: 3px solid #6B6B6B; }
.diag-finding-success  { background: #ecfdf5; border-color: #a7f3d0; }
.diag-finding-header { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.diag-finding-title  { font-size: 13.5px; font-weight: 600; }
.diag-finding-desc   { font-size: 12.5px; color: var(--muted); margin-bottom: 10px; }
.diag-finding-rec    { font-size: 12px; padding: 8px 10px; background: rgba(0,0,0,.04); border-radius: 6px; }
.diag-no-findings { display: flex; align-items: center; gap: 12px; color: var(--green); font-size: 14px; padding: 20px 0; }
.diag-featured-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.diagnostic-empty-state { text-align: center; padding: 60px 24px; color: var(--muted); }
.diag-empty-icon { margin-bottom: 16px; opacity: .3; }
.diag-empty-icon svg { display: block; margin: auto; }

.diagnostic-featured-card .diag-findings-preview { margin-top: 16px; }

/* ─── Score Pills ───────────────────────────────────────────────────────────── */
.score-pill { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 22px; border-radius: 5px; font-size: 12px; font-weight: 700; }
.score-pill-excellent { background: #ecfdf5; color: #065f46; }
.score-pill-good      { background: #f0fdf4; color: #166534; }
.score-pill-warning   { background: #fffbeb; color: #92400e; }
.score-pill-critical  { background: #fef2f2; color: #991b1b; }

/* ─── DRE Table ─────────────────────────────────────────────────────────────── */
.dre-table { font-size: 13.5px; }
.dre-section-header { display: flex; justify-content: space-between; padding: 10px 12px; border-radius: 6px; font-weight: 600; font-size: 13px; }
.dre-revenue { background: #ecfdf5; color: #065f46; }
.dre-expense { background: #fef2f2; color: #991b1b; }
.dre-row { display: flex; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.dre-row:last-child { border-bottom: none; }
.dre-result { margin-top: 12px; border-top: 2px solid var(--border); padding-top: 12px; }
.dre-result-row { display: flex; justify-content: space-between; padding: 6px 12px; font-weight: 600; font-size: 14px; }
.dre-result-label { font-size: 14px; font-weight: 600; }
.dre-result-value.positive { color: var(--green); }
.dre-result-value.negative { color: var(--red); }
.dre-margin { color: var(--muted); font-size: 12.5px; font-weight: 400; }

/* ─── Category Tags ──────────────────────────────────────────────────────────── */
.category-tag { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 500; }
.category-tag-revenue { background: #ecfdf5; color: #065f46; }
.category-tag-expense { background: #fef2f2; color: #991b1b; }

.category-list { list-style: none; padding: 0; margin: 0; }
.category-item { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-bottom: 1px solid var(--border); }
.category-item:last-child { border-bottom: none; }
.category-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.category-dot-revenue { background: var(--green); }
.category-dot-expense { background: var(--red); }
.category-name { font-size: 13.5px; flex: 1; }

/* ─── Role & Plan Badges ────────────────────────────────────────────────────── */
.role-badge { display: inline-flex; padding: 2px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 600; }
.role-badge-admin      { background: rgba(184,155,94,.15); color: var(--gold); }
.role-badge-gestor     { background: rgba(47,111,94,.1); color: var(--green); }
.role-badge-financeiro { background: #eff6ff; color: #1e40af; }
.role-badge-profissional { background: rgba(124,58,237,.12); color: #6d28d9; }
.role-badge-secretaria   { background: #f1f5f9; color: #475569; }
.role-badge-comercial    { background: #fff7ed; color: #c2410c; }

.plan-badge { display: inline-flex; padding: 2px 8px; border-radius: 4px; font-size: 11.5px; font-weight: 600; }
.plan-badge-starter      { background: var(--cream); color: var(--muted); border: 1px solid var(--border); }
.plan-badge-professional { background: rgba(47,111,94,.1); color: var(--green); }
.plan-badge-enterprise   { background: rgba(184,155,94,.15); color: var(--gold); }
.plan-badge-essencial     { background: var(--cream); color: var(--muted); border: 1px solid var(--border); }
.plan-badge-performance   { background: rgba(47,111,94,.1); color: var(--green); }
.plan-badge-personalizado { background: rgba(184,155,94,.15); color: var(--gold); }

/* ─── User Avatar ───────────────────────────────────────────────────────────── */
.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--gold); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; flex-shrink: 0; overflow: hidden; }
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ── Avatar do usuário: campo de edição + cropper ──────────────────────────── */
.av-edit { display: flex; align-items: center; gap: 16px; }
.av-edit-preview { width: 72px; height: 72px; border-radius: 50%; overflow: hidden; background: var(--gold); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 600; flex-shrink: 0; }
.av-edit-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.av-edit-actions { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.av-edit-hint { font-size: 12px; color: var(--muted); }
.btn-link-danger { background: none; border: none; color: var(--red, #B94A48); cursor: pointer; padding: 0; font-size: 13px; }
.btn-link-danger:hover { text-decoration: underline; }
.btn-link-danger[hidden] { display: none; }

.av-crop-overlay { position: fixed; inset: 0; background: rgba(20,21,25,.6); display: flex; align-items: center; justify-content: center; z-index: 1000; }
.av-crop-overlay[hidden] { display: none; }
.av-crop-box { background: #fff; border-radius: 14px; padding: 20px; box-shadow: 0 20px 50px rgba(0,0,0,.3); }
.av-crop-title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 14px; text-align: center; }
.av-crop-stage { position: relative; width: 288px; height: 288px; max-width: 84vw; aspect-ratio: 1; margin: 0 auto; border-radius: 10px; overflow: hidden; background: #1A1B1F; cursor: grab; }
.av-crop-stage:active { cursor: grabbing; }
.av-crop-stage canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.av-crop-mask { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 999px rgba(20,21,25,.55); pointer-events: none; }
.av-crop-zoom-row { display: flex; align-items: center; gap: 10px; margin: 16px 2px 4px; color: var(--muted); }
.av-crop-zoom-row input[type=range] { flex: 1; accent-color: var(--gold); }
.av-crop-hint { font-size: 12px; color: var(--muted); text-align: center; margin: 4px 0 14px; }
.av-crop-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ─── Admin Badge ───────────────────────────────────────────────────────────── */
.admin-badge { display: inline-flex; align-items: center; padding: 4px 10px; background: rgba(184,155,94,.12); color: var(--gold); border-radius: 20px; font-size: 11.5px; font-weight: 600; letter-spacing: .04em; }

/* ─── Status Pill ───────────────────────────────────────────────────────────── */
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.status-pill-success { background: #ecfdf5; color: var(--green); }

/* ─── Calc Preview ──────────────────────────────────────────────────────────── */
.calc-preview { background: var(--cream); border-radius: 8px; padding: 16px; }
.calc-preview-title { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 12px; }
.calc-grid  { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.calc-item  { display: flex; flex-direction: column; gap: 3px; }
.calc-label { font-size: 11px; color: var(--muted); }
.calc-value { font-size: 16px; font-weight: 650; }

/* ─── Detail List ───────────────────────────────────────────────────────────── */
.detail-list { display: flex; flex-direction: column; gap: 0; }

/* Linha rótulo→valor (rótulo à esquerda, valor à direita) com separador sutil */
.detail-row {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
    padding: 9px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row dt { color: var(--muted); flex-shrink: 0; }
.detail-row dd {
    margin: 0;
    text-align: right;
    font-weight: 600;
    color: var(--graphite);
    min-width: 0;
    overflow-wrap: anywhere;
}
.detail-row--stack { flex-direction: column; align-items: stretch; gap: 4px; }
.detail-row--stack dd { text-align: left; font-weight: 400; font-size: 12.5px; }

.detail-item { display: flex; flex-direction: column; padding: 10px 0; border-bottom: 1px solid var(--border); }
.detail-item:last-child { border-bottom: none; }
.detail-item dt { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 3px; }
.detail-item dd { font-size: 13.5px; }

/* ─── Info Box ──────────────────────────────────────────────────────────────── */
.info-box { background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 8px; padding: 12px 14px; font-size: 12.5px; color: #1e40af; }

/* ─── Steps List ─────────────────────────────────────────────────────────────── */
.steps-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.step-item  { display: flex; align-items: flex-start; gap: 12px; font-size: 13px; }
.step-num   { width: 22px; height: 22px; border-radius: 50%; background: var(--graphite); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; flex-shrink: 0; }
.code-inline { background: var(--cream); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-family: monospace; font-size: 12px; }
.link-external { color: var(--gold); }

/* ─── Sync Status ───────────────────────────────────────────────────────────── */
.sync-status { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }

/* ─── KPI Detail Cards ──────────────────────────────────────────────────────── */
.kpi-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.kpi-detail-card {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border-left: 4px solid transparent;
}
.kpi-detail-card.kpi-status-ok       { border-left-color: var(--green); }
.kpi-detail-card.kpi-status-warning  { border-left-color: #d97706; }
.kpi-detail-card.kpi-status-critical { border-left-color: var(--red); }
.kpi-detail-card.kpi-status-nodata   { border-left-color: var(--border); }

.kpi-detail-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 12px; }
.kpi-detail-name   { font-size: 14px; font-weight: 600; }
.kpi-detail-meta   { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.kpi-detail-value  { font-size: 28px; font-weight: 650; letter-spacing: -.03em; margin: 8px 0; }
.kpi-status-badge  { display: inline-flex; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; }
.kpi-status-badge.kpi-status-ok       { background: #ecfdf5; color: #065f46; }
.kpi-status-badge.kpi-status-warning  { background: #fffbeb; color: #92400e; }
.kpi-status-badge.kpi-status-critical { background: #fef2f2; color: #991b1b; }
.kpi-status-badge.kpi-status-nodata   { background: #f4f4f5; color: #71717a; }

.kpi-progress-track { height: 5px; background: var(--border); border-radius: 3px; margin-top: 12px; overflow: hidden; }
.kpi-progress-fill  { height: 100%; border-radius: 3px; transition: width .4s ease; }
.kpi-progress-fill.kpi-status-ok       { background: var(--green); }
.kpi-progress-fill.kpi-status-warning  { background: #d97706; }
.kpi-progress-fill.kpi-status-critical { background: var(--red); }
.kpi-progress-fill.kpi-status-nodata   { background: var(--border); }
.kpi-progress-labels { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.kpi-deviation.positive { color: var(--green); }
.kpi-deviation.negative { color: var(--red); }

/* ─── Diagnostic Detail ─────────────────────────────────────────────────────── */
.diag-score-ring-lg { width: 100px; height: 100px; border-radius: 50%; border: 4px solid; display: flex; flex-direction: column; align-items: center; justify-content: center; margin: 0 auto 12px; }
.diag-score-ring-lg.score-excellent { border-color: var(--green); color: var(--green); }
.diag-score-ring-lg.score-good      { border-color: #16a34a;      color: #16a34a; }
.diag-score-ring-lg.score-warning   { border-color: #d97706;      color: #d97706; }
.diag-score-ring-lg.score-critical  { border-color: var(--red);   color: var(--red); }
.diag-score-num   { font-size: 30px; font-weight: 700; line-height: 1; }
.diag-score-max   { font-size: 12px; opacity: .6; }
.diag-score-label-lg { font-size: 18px; font-weight: 650; text-align: center; }
.diag-score-sub   { font-size: 12px; color: var(--muted); text-align: center; }
.diag-score-breakdown { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 8px; }
.score-stat  { display: flex; flex-direction: column; align-items: center; font-size: 11px; color: var(--muted); }
.score-stat-num { font-size: 22px; font-weight: 700; line-height: 1.1; }

.diag-finding-full {
    border-radius: 10px; padding: 20px;
    border: 1px solid;
}
.diag-finding-full.diag-finding-critical { background: #fff; border-color: #E6E1D8; border-left: 3px solid #171717; }
.diag-finding-full.diag-finding-warning  { background: #fff; border-color: #E6E1D8; border-left: 3px solid #B89B5E; }
.diag-finding-full.diag-finding-info     { background: #fff; border-color: #E6E1D8; border-left: 3px solid #6B6B6B; }
.diag-finding-full.diag-finding-success  { background: #fff; border-color: #E6E1D8; border-left: 3px solid #8A7B52; }
/* Badges de severidade em tons monocromáticos (escopo: cards de diagnóstico) */
.diag-finding-critical .badge-critical { background: rgba(23,23,23,.08);   color: #171717; }
.diag-finding-warning  .badge-warning  { background: rgba(184,155,94,.18); color: #8A6F2E; }
.diag-finding-info     .badge-info     { background: rgba(107,107,107,.14); color: #4B4B4B; }
.diag-finding-success  .badge-success  { background: rgba(138,123,82,.16); color: #6E6038; }
.diag-finding-full-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.diag-finding-full-title  { font-size: 15px; font-weight: 600; }
.diag-finding-kpi-pill { margin-left: auto; font-size: 12px; color: var(--muted); background: rgba(0,0,0,.05); padding: 3px 8px; border-radius: 20px; }
.diag-finding-full-desc   { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }
.diag-finding-cause { font-size: 13px; padding: 10px 12px; background: rgba(0,0,0,.04); border-radius: 6px; margin-bottom: 10px; }
.diag-finding-rec-full { display: flex; gap: 12px; align-items: flex-start; font-size: 13.5px; padding: 12px 14px; background: rgba(0,0,0,.04); border-radius: 8px; }
.diag-rec-icon { flex-shrink: 0; color: var(--gold); margin-top: 2px; }
.diag-no-findings-full { text-align: center; padding: 60px 24px; }
.diag-no-findings-full svg { display: block; margin: auto; margin-bottom: 16px; color: var(--green); opacity: .5; }
.diag-no-findings-full h3 { font-size: 18px; font-weight: 600; margin-bottom: 8px; }
.diag-no-findings-full p  { color: var(--muted); }

/* ─── Report Sections ───────────────────────────────────────────────────────── */
.report-section { margin-top: 32px; }
.report-section-title { font-size: 16px; font-weight: 650; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid var(--border); }
.kpi-alert { padding: 10px 14px; border-radius: 7px; font-size: 13.5px; }
.kpi-alert-critical { background: #fef2f2; border-left: 3px solid var(--red); }
.kpi-alert-warning  { background: #fffbeb; border-left: 3px solid #d97706; }
.diag-finding-report { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 7px; border: 1px solid; font-size: 13.5px; }
.diag-finding-report p { margin: 0; font-size: 12.5px; }

/* ─── Meta Ads ──────────────────────────────────────────────────────────────── */
.ad-name-cell  { display: flex; flex-direction: column; }
.ad-name       { font-size: 13px; font-weight: 500; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ad-adset      { font-size: 11px; color: var(--muted); margin-top: 1px; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ─── Variation Indicators ──────────────────────────────────────────────────── */
.variation-up   { color: var(--green); font-size: 12px; font-weight: 500; }
.variation-down { color: var(--red);   font-size: 12px; font-weight: 500; }
.variation-neutral { color: var(--muted); font-size: 12px; }

/* ─── KPI Tooltip ────────────────────────────────────────────────────────────── */
.kpi-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: help;
    margin-left: 4px;
    vertical-align: middle;
}
.kpi-tip svg {
    color: var(--muted);
    opacity: .45;
    transition: opacity .15s;
    flex-shrink: 0;
}
.kpi-tip:hover svg { opacity: .85; }
.kpi-tip-content {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #1e1e1e;
    color: #f0f0f0;
    font-size: 11.5px;
    line-height: 1.5;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    padding: 7px 11px;
    border-radius: 7px;
    width: max-content;
    max-width: 210px;
    white-space: normal;
    pointer-events: none;
    opacity: 0;
    transition: opacity .15s;
    z-index: 200;
    box-shadow: 0 4px 14px rgba(0,0,0,.25);
}
.kpi-tip:hover .kpi-tip-content { opacity: 1; }
.kpi-tip-content::after {
    content: '';
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #1e1e1e;
}

/* ─── Breakeven Progress Bar ─────────────────────────────────────────────────── */
.breakeven-bar-wrap {
    background: var(--border);
    border-radius: 99px;
    height: 6px;
    margin-top: 10px;
    overflow: hidden;
}
.breakeven-bar {
    height: 100%;
    border-radius: 99px;
    background: linear-gradient(90deg, var(--gold), var(--green));
    transition: width .4s ease;
}
.kpi-card-breakeven { border-color: rgba(184,155,94,.25); }

/* ═══════════════════════════════════════════════════════════════════════════
   AGENDA — Redesign visual
   ═══════════════════════════════════════════════════════════════════════════ */

/* Wrapper interno do calendário */
.cal-wrap { padding: 4px 16px 20px; }

/* ── Filtro de profissional ──────────────────────────────────────────────── */
.cal-filter-select {
    height: 32px;
    padding: 0 28px 0 10px;
    font-size: 13px;
    min-width: 170px;
    border-radius: 7px;
    border: 1px solid var(--border);
    background: #fff;
    color: #374151;
    outline: none;
    cursor: pointer;
    appearance: auto;
}
.cal-filter-select:focus {
    border-color: #2F6F5E;
    box-shadow: 0 0 0 3px rgba(47,111,94,.15);
}

/* ── Legenda ─────────────────────────────────────────────────────────────── */
.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    padding: 8px 16px 10px;
    border-bottom: 1px solid var(--border);
    font-size: 11.5px;
    color: #6B6B6B;
    align-items: center;
    background: var(--cream);
}
.cal-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    line-height: 1;
}
.cal-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cal-legend-sdot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}
.cal-legend-sep {
    width: 1px;
    height: 14px;
    background: var(--border);
    margin: 0 2px;
}

/* ── Cards de evento — semana / dia ─────────────────────────────────────── */
.fc-evt-card {
    display: flex;
    flex-direction: column;
    gap: 1px;
    padding: 4px 6px 5px 10px;   /* folga à esquerda p/ a bolinha não encostar na barra de status */
    width: 100%;
    overflow: hidden;
    position: relative;
}
/* Bolinha de status no card do agendamento */
.fc-evt-status-dot {
    display: inline-block; width: 8px; height: 8px; border-radius: 50%;
    margin-right: 5px; vertical-align: middle; flex-shrink: 0;
    box-shadow: 0 0 0 1px rgba(255,255,255,.6);
}
.fc-evt-name {
    font-weight: 700;
    font-size: 12.5px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #111827;
}
.fc-evt-proc {
    font-size: 11px;
    line-height: 1.25;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #374151;
    opacity: .75;
}
.fc-evt-prof {
    font-size: 10.5px;
    line-height: 1.2;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #374151;
    opacity: .6;
    margin-top: 1px;
}

/* ── Card de bloqueio de agenda ── */
.fc-event.fc-block-event {
    background: repeating-linear-gradient(45deg, #EEEBE6, #EEEBE6 6px, #E3DFD8 6px, #E3DFD8 12px) !important;
    border: 1px solid #D8D3CA !important;
    border-left: 3px solid #9A968C !important;
    border-radius: 6px !important;
    box-shadow: none !important;
    cursor: default !important;
}
.fc-evt-block { padding: 3px 7px; overflow: hidden; width: 100%; }
.fc-evt-block-title {
    display: flex; align-items: center; gap: 4px;
    font-size: 12px; font-weight: 700; color: #5A564E; line-height: 1.2;
}
.fc-evt-block-title svg { flex-shrink: 0; opacity: .8; }
.fc-evt-block-meta {
    font-size: 11px; color: #6B6B6B; line-height: 1.25; margin-top: 1px;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ── Botão Atender (aparece no hover do card) ────────────────────────────── */
.fc-atender-btn {
    display: inline-block;
    margin-top: 4px;
    padding: 2px 8px;
    background: #2F6F5E;
    color: #fff !important;
    border-radius: 4px;
    font-size: 10.5px;
    font-weight: 600;
    text-decoration: none !important;
    line-height: 1.6;
    opacity: 0;
    transition: opacity .12s ease;
    align-self: flex-start;
    pointer-events: none;
}
.fc-event:hover .fc-atender-btn,
.fc-event:focus-within .fc-atender-btn {
    opacity: 1;
    pointer-events: auto;
}

/* ── Card mês — linha compacta ───────────────────────────────────────────── */
.fc-evt-month {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 1px 4px 1px 8px;   /* folga à esquerda p/ a bolinha de status */
    overflow: hidden;
    width: 100%;
}
.fc-evt-name-sm {
    font-size: 11.5px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: #111827;
    line-height: 1.4;
}
.fc-evt-sdot {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    display: inline-block;
}
.fc-evt-sdot--agendado   { background: #2563eb; }
.fc-evt-sdot--compareceu { background: #059669; }
.fc-evt-sdot--faltou     { background: #ea580c; }
.fc-evt-sdot--cancelado  { background: #94a3b8; }

/* ── Lista view ──────────────────────────────────────────────────────────── */
.fc-evt-list {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 2px 0;
    padding: 3px 0;
    width: 100%;
}
.fc-evt-list-name { font-size: 13px; font-weight: 600; color: #111827; }
.fc-evt-list-proc { font-size: 12.5px; color: #6B6B6B; }
.fc-evt-list-prof { font-size: 11px; color: #9CA3AF; width: 100%; margin-top: 1px; }
.fc-status-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    margin-left: 8px;
    vertical-align: middle;
}

/* ── FullCalendar overrides (semana/dia) ────────────────────────────────── */
.fc .fc-timegrid-slot        { height: 28px; }
.fc .fc-timegrid-event       { min-height: 28px; border-radius: 6px !important; }
.fc .fc-timegrid-event .fc-event-main { padding: 0; overflow: visible; }
.fc .fc-daygrid-event        { border-radius: 5px !important; }
.fc .fc-daygrid-event-dot    { display: none; }
.fc .fc-list-event-dot       { display: none; }
.fc .fc-daygrid-more-link    { font-size: 11px; font-weight: 600; color: #2F6F5E; padding: 1px 4px; }
/* Indicador de agora — dourado (cobre linha e seta) */
.fc { --fc-now-indicator-color: #B89B5E; }
.fc .fc-timegrid-now-indicator-line  { border-color: #B89B5E; border-width: 2px; }
.fc .fc-timegrid-now-indicator-arrow { border-color: #B89B5E; border-top-color: transparent; border-bottom-color: transparent; }
/* Cabeçalho de dia na semana */
.fc .fc-col-header-cell { background: var(--cream); }
.fc .fc-col-header-cell-cushion { padding: 7px 0; font-size: 12px; font-weight: 600; color: #374151; text-decoration: none; }
.fc .fc-day-today .fc-col-header-cell-cushion { color: #2F6F5E; }
/* Time axis mais fino */
.fc .fc-timegrid-axis-cushion { font-size: 10.5px; color: #9CA3AF; padding-right: 6px; }

/* ── Tooltip flutuante ───────────────────────────────────────────────────── */
.cal-tooltip {
    position: fixed;
    z-index: 9999;
    background: #fff;
    border: 1px solid var(--border);
    border-left: 4px solid #2F6F5E;
    border-radius: 10px;
    box-shadow: 0 8px 28px rgba(0,0,0,.14), 0 2px 6px rgba(0,0,0,.06);
    padding: 12px 14px;
    min-width: 210px;
    max-width: 280px;
    pointer-events: none;
    font-size: 13px;
    line-height: 1.5;
    animation: tooltipFadeIn .1s ease;
}
@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateY(4px); }
    to   { opacity: 1; transform: translateY(0); }
}
.ct-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 6px;
}
.ct-time   { font-size: 11.5px; font-weight: 600; color: #6B6B6B; }
.ct-patient { font-size: 14px; font-weight: 700; color: #111827; margin-bottom: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 252px; }
.ct-procedure { font-size: 12px; color: #6B6B6B; margin-bottom: 2px; }
.ct-prof   { font-size: 11.5px; color: #9CA3AF; }
.ct-status-badge {
    font-size: 10.5px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 10px;
    flex-shrink: 0;
}

/* ── Visão Mês: evento colorido (só o nome), contido na célula ───────────── */
.fc-dayGridMonth-view .fc-daygrid-event {
    padding: 2px 6px;
    margin-top: 2px;
    max-width: 100%;
    overflow: hidden;            /* nunca invade o dia vizinho */
    cursor: pointer;
}
.fc-dayGridMonth-view .fc-daygrid-event-harness { max-width: 100%; }
/* O nome é flex-child: precisa de min-width:0 para encolher e aplicar ellipsis */
.fc-dayGridMonth-view .fc-evt-month { max-width: 100%; min-width: 0; }
.fc-dayGridMonth-view .fc-evt-name-sm {
    min-width: 0;
    flex: 1 1 auto;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Modal de ações do agendamento ───────────────────────────────────────── */
.cal-action-overlay {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(17, 24, 39, .45);
    animation: tooltipFadeIn .12s ease;
}
.cal-action-box {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0,0,0,.25);
    width: 360px;
    max-width: calc(100vw - 32px);
    overflow: hidden;
}
.cal-action-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border, #E6E1D8);
}
.cal-action-patient { font-size: 15px; font-weight: 700; color: #111827; line-height: 1.3; }
.cal-action-meta    { font-size: 12px; color: #6B7280; margin-top: 3px; }
.cal-action-close {
    flex-shrink: 0;
    border: none;
    background: none;
    color: #9CA3AF;
    font-size: 16px;
    cursor: pointer;
    line-height: 1;
    padding: 2px 4px;
}
.cal-action-close:hover { color: #111827; }
/* Botões de mudança rápida de status no popup do agendamento */
.cal-action-status { display: flex; gap: 8px; padding: 12px 16px 4px; }
.cam-status-btn {
    flex: 1; padding: 8px 6px; border: 1px solid var(--border, #E6E1D8); border-radius: 8px;
    background: #fff; font-family: inherit; font-size: 12.5px; font-weight: 600; color: #6B6B6B;
    cursor: pointer; transition: all .12s;
}
.cam-status-btn:hover { border-color: #C9C2B5; color: var(--text, #171717); }
.cam-status-btn[data-status="pendente"].is-active   { background: #2563eb; border-color: #2563eb; color: #fff; }
.cam-status-btn[data-status="confirmado"].is-active { background: #059669; border-color: #059669; color: #fff; }
.cam-status-btn[data-status="cancelado"].is-active  { background: #94a3b8; border-color: #94a3b8; color: #fff; }
.cam-status-btn[data-status="faltou"].is-active      { background: #111827; border-color: #111827; color: #fff; }

.cal-action-list { padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.cal-action-item {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13.5px;
    font-weight: 500;
    color: #374151;
    text-decoration: none;
    transition: background .12s, color .12s;
}
.cal-action-item svg { color: #9CA3AF; flex-shrink: 0; }
.cal-action-item:hover { background: var(--cream, #F7F5F0); color: #111827; }
.cal-action-item:hover svg { color: #2F6F5E; }
.cal-action-item--primary { color: #2F6F5E; font-weight: 600; }
.cal-action-item--primary svg { color: #2F6F5E; }
.cal-action-item--primary:hover { background: #2F6F5E; color: #fff; }
.cal-action-item--primary:hover svg { color: #fff; }

/* ── Cards de acesso centralizados (painel admin) ────────────────────────── */
/* ── Hub de Configurações (cards) ────────────────────────────────────────── */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 8px;
}
.settings-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 4px;
    padding: 24px 20px;
    background: #fff;
    border: 1px solid var(--border, #E6E1D8);
    border-radius: 12px;
    text-decoration: none;
    transition: border-color .12s, box-shadow .12s, transform .12s;
}
.settings-card:hover {
    border-color: #2F6F5E;
    box-shadow: 0 6px 18px rgba(0,0,0,.07);
    transform: translateY(-2px);
}
.settings-card-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: var(--cream, #F7F5F0);
    color: #2F6F5E;
    margin-bottom: 8px;
}
.settings-card-title { font-size: 14.5px; font-weight: 600; color: #111827; }
.settings-card-desc  { font-size: 12.5px; color: #9A968C; }

/* ── Fullscreen overrides ────────────────────────────────────────────────── */
#calendar-card:fullscreen .cal-legend { background: #fff; }
#calendar-card:fullscreen .cal-wrap   { padding: 4px 20px 20px; }

/* integration-sync-* styles moved to integrations.css */

/* ── Mini day-view calendar picker ──────────────────────────────────────── */

/* Container geral */
.adv-wrap {
    grid-column: 1 / -1;
    border: 1px solid var(--border, #E6E1D8);
    border-radius: 12px;
    overflow: hidden;
    background: #fff;
}

/* Cabeçalho com data e resumo */
.adv-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
    background: var(--cream, #F7F5F0);
    border-bottom: 1px solid var(--border, #E6E1D8);
    flex-wrap: wrap;
}
.adv-date-input {
    font-size: 13.5px !important;
    font-weight: 600 !important;
    border: 1px solid var(--green, #2F6F5E) !important;
    background: rgba(47, 111, 94, .08) !important;
    padding: 8px 14px !important;
    width: auto !important;
    min-width: 150px;
    cursor: pointer;
    color: var(--green, #2F6F5E) !important;
    border-radius: 8px !important;
    outline: none !important;
    box-shadow: none !important;
    transition: background .15s ease, box-shadow .15s ease;
}
.adv-date-input:hover {
    background: rgba(47, 111, 94, .15) !important;
    box-shadow: 0 2px 8px rgba(47, 111, 94, .18);
}
.adv-date-input::placeholder { color: var(--green, #2F6F5E); opacity: .7; }
.adv-summary {
    font-size: 12px;
    color: #9CA3AF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 280px;
    font-style: italic;
}

/* Área scrollável da timeline */
.adv-timeline-outer {
    height: 380px;
    overflow-y: auto;
    overflow-x: hidden;
    scroll-behavior: smooth;
}
.adv-timeline-outer::-webkit-scrollbar { width: 4px; }
.adv-timeline-outer::-webkit-scrollbar-track { background: transparent; }
.adv-timeline-outer::-webkit-scrollbar-thumb { background: #E6E1D8; border-radius: 2px; }

/* Timeline (posicionamento absoluto de todos os filhos) */
.adv-timeline {
    position: relative;
    user-select: none;
}

/* Linha de hora */
.adv-hour-row {
    position: absolute;
    left: 0; right: 0;
    display: flex;
    align-items: flex-start;
    pointer-events: none;
}
.adv-lbl {
    width: 44px;
    flex-shrink: 0;
    font-size: 10.5px;
    color: #9CA3AF;
    text-align: right;
    padding-right: 8px;
    margin-top: -7px;
    line-height: 1;
}
.adv-hline {
    flex: 1;
    border-top: 1px solid #E6E1D8;
}

/* Linha de meia-hora */
.adv-half-row {
    position: absolute;
    left: 44px; right: 0;
    pointer-events: none;
    border-top: 1px dashed #F0EDE6;
}

/* Overlay clicável */
.adv-overlay {
    position: absolute;
    left: 44px; right: 0; top: 0; bottom: 0;
    cursor: crosshair;
    z-index: 1;
}
.adv-overlay:hover { background: rgba(47,111,94,.03); }

/* Bloco de seleção */
.adv-selection {
    position: absolute;
    left: 48px; right: 6px;
    background: rgba(47,111,94,.14);
    border: 2px solid #2F6F5E;
    border-radius: 6px;
    z-index: 2;
    cursor: move;
    min-height: 20px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.adv-sel-body {
    padding: 4px 8px;
    display: flex;
    align-items: baseline;
    gap: 6px;
    pointer-events: none;
    flex: 1;
}
.adv-sel-time {
    font-size: 12px;
    font-weight: 700;
    color: #1e4f43;
    line-height: 1.3;
}
.adv-sel-dur {
    font-size: 11px;
    color: #2F6F5E;
    opacity: .8;
}

/* Handle inferior para redimensionar */
.adv-sel-handle {
    height: 10px;
    cursor: s-resize;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.adv-sel-handle::before {
    content: '';
    width: 28px;
    height: 3px;
    border-radius: 2px;
    background: #2F6F5E;
    opacity: .45;
}

/* Indicador de hora atual */
.adv-now {
    position: absolute;
    left: 44px; right: 0;
    border-top: 2px solid #B89B5E;
    z-index: 3;
    pointer-events: none;
}
.adv-now::before {
    content: '';
    position: absolute;
    left: -5px;
    top: -5px;
    width: 8px; height: 8px;
    border-radius: 50%;
    background: #B89B5E;
}

/* Hover ghost line */
.adv-hover-line {
    position: absolute;
    left: 44px; right: 0;
    border-top: 1px dashed rgba(47,111,94,.35);
    pointer-events: none;
    z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════
   Mobile / responsivo
   - Convive com o sistema de collapse desktop existente (body.sidebar-collapsed).
   - ≤ 900px: sidebar vira drawer off-canvas + hambúrguer no topbar.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Estado base (desktop) — escondidos */
.topbar-burger     { display: none; }
.sidebar-backdrop  { display: none; }

/* ─── ≤ 1024px — tablets: padding e gaps menores ─────────────────────────── */
@media (max-width: 1024px) {
    #main-wrap > main.flex-1.p-8 { padding: 24px !important; }
    .page-header { gap: 16px; margin-bottom: 22px; }
}

/* ─── ≤ 900px — drawer ativa ──────────────────────────────────────────────── */
@media (max-width: 900px) {

    /* Sidebar vira drawer off-canvas (anula collapse desktop) */
    .sidebar {
        transform: translateX(-100%);
        transition: transform .25s ease;
        will-change: transform;
        box-shadow: 0 0 24px rgba(0,0,0,.18);
    }
    .sidebar.is-open { transform: translateX(0); }

    /* No mobile, ignorar o collapse desktop (sempre largura cheia, labels visíveis) */
    body.sidebar-collapsed .sidebar               { width: var(--sidebar-w); }
    body.sidebar-collapsed .sidebar-logo-text,
    body.sidebar-collapsed .sidebar-section-label,
    body.sidebar-collapsed .sidebar-link-label,
    body.sidebar-collapsed .sidebar-user-name,
    body.sidebar-collapsed .sidebar-user-role     { display: initial; }
    body.sidebar-collapsed .sidebar-logo          { padding: 20px 16px 16px; }
    body.sidebar-collapsed .sidebar-logo > div    { flex-direction: row; align-items: center; gap: 12px; }
    body.sidebar-collapsed nav                    { padding-left: 16px; padding-right: 16px; }
    body.sidebar-collapsed .sidebar-link          { justify-content: flex-start; padding: 11px 12px; }
    body.sidebar-collapsed .sidebar-link-icon     { width: 20px; margin: 0; }
    body.sidebar-collapsed .sidebar-user          { justify-content: flex-start; padding: 14px 16px; gap: 10px; }
    .sidebar-collapse-btn                         { display: none !important; }

    /* Conteúdo principal: sem margem (anula ml-[240px] do Tailwind e collapse) */
    #main-wrap,
    body.sidebar-collapsed #main-wrap             { margin-left: 0 !important; }

    /* Backdrop escuro com o drawer aberto */
    .sidebar-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,.45);
        opacity: 0;
        pointer-events: none;
        transition: opacity .2s ease;
        z-index: 45;
    }
    body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
    /* Bloqueia scroll do body quando o drawer está aberto */
    body.sidebar-open { overflow: hidden; }

    /* Hambúrguer visível com alvo de toque de 40px */
    .topbar-burger {
        display: inline-flex;
        align-items: center; justify-content: center;
        width: 40px; height: 40px;
        background: transparent;
        border: 1px solid var(--border);
        border-radius: 8px;
        color: var(--text);
        cursor: pointer;
        flex-shrink: 0;
        transition: background .15s, border-color .15s;
    }
    .topbar-burger:hover         { background: var(--cream); border-color: #c8c2b8; }
    .topbar-burger:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

    /* Topbar compacta com quebra controlada */
    .topbar {
        padding: 0 14px !important;
        gap: 10px;
        height: auto;
        min-height: 56px;
        flex-wrap: wrap;
    }
    .topbar-left        { display: flex; align-items: center; gap: 10px; min-width: 0; }
    .topbar-right       { gap: 8px; flex-wrap: wrap; }
    .topbar-logo        { width: 28px; height: 28px; }
    .topbar-clinic-name { display: none; }
    .topbar-divider     { display: none; }
    .topbar-page-title  { font-size: 14px; font-weight: 600; color: var(--text); }

    /* Meta status reduzido a um ponto colorido */
    .topbar-meta-status .status-label { display: none; }
    .topbar-meta-status { padding: 6px; width: 28px; height: 28px; border-radius: 50%; justify-content: center; }

    /* Período sem o rótulo "Período:" */
    .topbar-period-label { display: none; }
    .topbar-period-input { padding: 8px 10px; font-size: 13px; }

    /* Barra de "visualizando como admin" empilha */
    .admin-viewing-bar  { flex-wrap: wrap; font-size: 12px; padding: 8px 12px; line-height: 1.4; }
    .admin-viewing-leave { margin-left: auto; }

    /* Main content com padding menor (anula .p-8 do Tailwind) */
    #main-wrap > main.flex-1.p-8 { padding: 16px !important; }

    /* Page header empilha verticalmente */
    .page-header {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
        margin-bottom: 18px;
    }
    .page-title    { font-size: 18px; }
    .page-subtitle { font-size: 12.5px; }

    /* Cards com padding menor */
    .card-header { padding: 14px 16px 12px; }
    .card-body   { padding: 14px 16px; }

    /* KPI cards mais densos */
    .kpi-card   { padding: 14px; }
    .kpi-value  { font-size: 22px; }
    .kpi-label  { font-size: 11px; }

    /* Filtros: 1 por linha, label em cima, inputs full-width */
    .filter-bar  { padding: 12px; }
    .filter-form { gap: 10px; }
    .filter-form > * { flex: 1 1 100%; }
    .filter-group {
        flex-direction: column;
        align-items: stretch;
        gap: 4px;
    }
    .filter-label { font-size: 11px; }
    .filter-select, .filter-input { width: 100%; padding: 10px 12px; font-size: 14px; }

    /* Forms: alvos de toque maiores e ações empilhadas */
    .form-input, .form-select, .form-textarea { padding: 11px 13px; font-size: 14.5px; }
    .form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
        gap: 10px;
    }
    .form-actions > * { width: 100%; justify-content: center; }

    /* Botões com altura mínima ≥ 40px */
    .btn-primary, .btn-secondary, .btn-ghost {
        min-height: 40px;
        padding: 10px 16px;
        font-size: 13.5px;
    }
    .btn-action { min-width: 36px; min-height: 36px; }

    /* Tabelas: scroll horizontal automático no card-body */
    .card .card-body            { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .card .card-body.p-0        { padding: 0; }
    .data-table                 { min-width: 540px; }
    .data-table th,
    .data-table td              { padding: 10px 12px; font-size: 12.5px; }

    /* Links da sidebar com alvo de toque maior dentro do drawer */
    .sidebar-link { padding: 11px 12px; font-size: 14px; }
}

/* ─── ≤ 640px — telefones pequenos ───────────────────────────────────────── */
@media (max-width: 640px) {
    #main-wrap > main.flex-1.p-8 { padding: 12px !important; }
    .page-title  { font-size: 17px; }
    .kpi-card    { padding: 12px; }
    .kpi-value   { font-size: 20px; }
    .kpi-label   { font-size: 10.5px; }

    /* Charts mais baixos pra não ocupar a tela toda */
    [id^="chart-"], .chart-container { min-height: 220px !important; }

    /* Trunca o título da página */
    .topbar-page-title {
        max-width: 55vw;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Card header empilha quando tem ação no header */
    .card-header { flex-direction: column; align-items: flex-start; gap: 6px; }
}

/* ─── Selos "Novo" / "Recorrente" (paciente/lead/conversa/atendimento) ──── */
.novo-badge,
.recorrente-badge {
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
    font-size: 9.5px;
    font-weight: 700;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: .04em;
    border-radius: 20px;
    padding: 2px 7px;
    white-space: nowrap;
    vertical-align: middle;
}
.recorrente-badge {
    color: #6B4FA0;
    background: #F3EEFB;
    border: 1px solid #E0D4F5;
}
.novo-badge {
    color: #2F855A;
    background: #E9F6EF;
    border: 1px solid #C6E6D0;
}

/* ─── Acessibilidade: respeita preferência de redução de movimento ──────── */
@media (prefers-reduced-motion: reduce) {
    .sidebar, .sidebar-backdrop, #main-wrap { transition: none !important; }
}
