/* =========================================
   RESET E BASE
   ========================================= */
* { box-sizing: border-box; }
body { 
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; 
    margin: 0; 
    background: #f3f4f6; 
    color: #111827; 
}

/* =========================================
   TELA DE LOGIN
   ========================================= */
.login-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.login-card { background: #fff; padding: 32px; border-radius: 12px; box-shadow: 0 4px 20px rgba(0,0,0,.08); width: 100%; max-width: 360px; }
.login-card h1 { margin: 0 0 4px; font-size: 22px; color: #111827; }
.login-card .sub { color: #6b7280; font-size: 14px; margin: 0 0 20px; }
.login-card label { display: block; margin-bottom: 12px; font-size: 13px; color: #374151; }
.login-card input { width: 100%; padding: 10px; border: 1px solid #d1d5db; border-radius: 6px; margin-top: 4px; font-size: 14px; }
.login-card button { width: 100%; padding: 11px; background: #2563eb; color: #fff; border: 0; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 15px; }
.msg { min-height: 18px; font-size: 13px; margin-bottom: 8px; font-weight: 500; }
.msg.error { color: #dc2626; }

/* =========================================
   LAYOUT PRINCIPAL
   ========================================= */
.topbar { display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: #111827; color: #fff; }
.topbar .brand { font-weight: 700; font-size: 18px; }
.topbar .user { margin-left: auto; font-size: 14px; opacity: .9; }
.topbar .user small { opacity: .6; margin-left: 4px; }
.btn-logout { background: transparent; border: 1px solid #374151; color: #fff; padding: 6px 12px; border-radius: 6px; cursor: pointer; }
.menu { display: flex; gap: 8px; padding: 12px 24px; background: #fff; border-bottom: 1px solid #e5e7eb; overflow-x: auto; }
.menu button { background: transparent; border: 1px solid #d1d5db; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; color: #374151; white-space: nowrap; }
.menu button.active { background: #2563eb; color: #fff; border-color: #2563eb; }
main { padding: 24px; max-width: 1400px; margin: 0 auto; }

/* =========================================
   DASHBOARD (INÍCIO)
   ========================================= */
.dashboard-container { display: flex; flex-direction: column; gap: 24px; }
.dashboard-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.dashboard-bottom-grid { 
    display: grid; 
    grid-template-columns: repeat(4, 1fr); 
    gap: 20px; 
}
.dash-card { background: #fff; border-radius: 10px; padding: 20px; box-shadow: 0 1px 3px rgba(0,0,0,.06); display: flex; flex-direction: column; }
.dash-title { margin: 0 0 16px 0; font-size: 18px; color: #111827; border-bottom: 1px solid #e5e7eb; padding-bottom: 12px; font-weight: 700; flex-shrink: 0; }
.dash-events-list { max-height: 400px; overflow-y: auto; padding-right: 8px; flex-grow: 1; }
.dash-events-list::-webkit-scrollbar { width: 6px; }
.dash-events-list::-webkit-scrollbar-track { background: #f1f1f1; border-radius: 4px; }
.dash-events-list::-webkit-scrollbar-thumb { background: #c1c1c1; border-radius: 4px; }
.dash-events-list::-webkit-scrollbar-thumb:hover { background: #a8a8a8; }
.empty-msg { color: #6b7280; font-size: 14px; font-style: italic; }

.dash-event { background: #f9fafb; border-left: 4px solid #6b7280; padding: 10px; margin-bottom: 10px; border-radius: 4px; box-shadow: 0 1px 2px rgba(0,0,0,0.05); }
.dash-ev-time { font-size: 13px; font-weight: 700; color: #2563eb; margin-bottom: 4px; }
.dash-ev-title { font-size: 14px; font-weight: 700; color: #111827; line-height: 1.3; margin-bottom: 4px; text-transform: uppercase; }
.dash-ev-sub { font-size: 12px; color: #6b7280; line-height: 1.3; }

.dash-header-flex { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid #e5e7eb; padding-bottom: 12px; margin-bottom: 16px; gap: 8px; flex-wrap: wrap; }
.dash-header-flex .dash-title { border: none; padding: 0; margin: 0; font-size: 16px; }
.dash-filter { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #374151; }
.dash-filter select { padding: 4px 8px; border: 1px solid #d1d5db; border-radius: 4px; background: #fff; font-size: 13px; }

.meus-eventos-list { display: flex; flex-direction: column; gap: 10px; }
.flex-ev { display: flex; align-items: center; gap: 16px; }
.flex-date { display: flex; flex-direction: column; align-items: center; min-width: 60px; border-right: 1px solid #e5e7eb; padding-right: 16px; }
.flex-date strong { font-size: 16px; color: #111827; }
.flex-date span { font-size: 13px; color: #2563eb; font-weight: 600; }
.flex-info { flex: 1; }

.acesso-item { background: #f8fafc; border: 1px solid #e2e8f0; padding: 12px; margin-bottom: 10px; border-radius: 6px; font-size: 13px; color: #475569; line-height: 1.4; }
.acesso-item strong { color: #1e293b; }

/* =========================================
   PAINÉIS E TABELAS (GERAL)
   ========================================= */
.panel { background: #fff; border-radius: 10px; padding: 24px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.panel-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; gap: 12px; flex-wrap: wrap; }
.panel-header h2 { margin: 0; font-size: 20px; color: #111827; }
.filtros { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; background: #f9fafb; padding: 12px; border-radius: 8px; border: 1px solid #e5e7eb; }
.filtros input, .filtros select { padding: 8px 12px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; background: #fff; }
.tabs { display: flex; gap: 4px; }
.tabs button { background: transparent; border: 1px solid #d1d5db; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 500; color: #4b5563; }
.tabs button.active { background: #2563eb; color: #fff; border-color: #2563eb; }
.tabela { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabela th { text-align: left; padding: 12px 10px; border-bottom: 2px solid #e5e7eb; background: #f9fafb; font-weight: 600; color: #374151; font-size: 13px; text-transform: uppercase; }
.tabela td { padding: 12px 10px; border-bottom: 1px solid #f3f4f6; vertical-align: middle; }
.tabela tr:hover td { background: #f9fafb; }
.tabela .actions { white-space: nowrap; text-align: right; }

/* =========================================
   BOTÕES
   ========================================= */
.btn-primary { background: #2563eb; color: #fff; border: 0; padding: 8px 16px; border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 14px; }
.btn-sec { background: #fff; color: #374151; border: 1px solid #d1d5db; padding: 8px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; }
.btn-edit { background: #fff; color: #2563eb; border: 1px solid #2563eb; padding: 5px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; margin-right: 4px; }
.btn-del { background: #fff; color: #dc2626; border: 1px solid #dc2626; padding: 5px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; }
.btn-success { background: #16a34a; color: #fff; border: none; }
.btn-success:hover { background: #15803d; }

/* =========================================
   MODAIS PADRÃO E AVISOS GERAIS
   ========================================= */
.modal-overlay { position: fixed; inset: 0; background: rgba(17, 24, 39, 0.6); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 9999; }
.modal { background: #fff; border-radius: 12px; padding: 24px; width: 100%; max-width: 520px; max-height: 90vh; overflow-y: auto; }
.modal h3 { margin-top: 0; margin-bottom: 20px; font-size: 18px; color: #111827; border-bottom: 1px solid #e5e7eb; padding-bottom: 12px; }
.modal label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 500; color: #374151; }
.modal label input, .modal label select, .modal label textarea { width: 100%; padding: 10px; border: 1px solid #d1d5db; border-radius: 6px; font-size: 14px; margin-top: 6px; font-family: inherit; }
.modal .row { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.modal .inline { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.modal .inline input { width: auto; margin: 0; cursor: pointer; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; padding-top: 16px; border-top: 1px solid #e5e7eb; }
.aviso { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; border-radius: 6px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; font-weight: 500; }

/* READ-ONLY / DESABILITADO */
.modal input:disabled,
.modal select:disabled,
.modal textarea:disabled {
    background-color: #f3f4f6 !important;
    color: #6b7280 !important;           
    cursor: not-allowed;                 
    border-color: #e5e7eb;
    opacity: 1; 
}

/* =========================================
   CHECKBOXES (LOTAÇÕES E PROFISSIONAIS)
   ========================================= */
.lotacoes-box, .profissionais-box {
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 12px;
    max-height: 160px;
    overflow-y: auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    background: #f9fafb;
    margin-top: 6px;
}
.lotacao-checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: normal; color: #1f2937; cursor: pointer; margin-bottom: 0 !important; }
.lotacao-checkbox input { width: 16px; height: 16px; margin: 0; cursor: pointer; accent-color: #2563eb; }
.checkbox-disabled { opacity: 0.5; cursor: not-allowed; }
.checkbox-disabled input, .checkbox-disabled span { cursor: not-allowed; }

/* =========================================
   CATEGORIAS (CRONOGRAMA)
   ========================================= */
.categorias-box { background: #f0fdf4; border: 1px solid #bbf7d0; border-radius: 6px; padding: 12px; margin-bottom: 14px; }
.cat-select { flex: 1; padding: 8px; border: 1px solid #86efac; border-radius: 4px; background: #fff; }

/* =========================================
   ESTATÍSTICAS (DASHBOARD DE LOTAÇÕES / CNES)
   ========================================= */
.lotacoes-dashboard { display: flex; gap: 16px; margin-bottom: 20px; }
.stat-card { flex: 1; background: #f8fafc; border: 1px solid #e2e8f0; padding: 16px; border-radius: 8px; display: flex; flex-direction: column; border-left: 5px solid #3b82f6; }
.stat-card.warning { background: #fef2f2; border-color: #fecaca; border-left-color: #ef4444; }
.stat-label { font-size: 13px; color: #64748b; font-weight: 600; text-transform: uppercase; margin-bottom: 8px; }
.stat-card.warning .stat-label { color: #b91c1c; }
.stat-value { font-size: 24px; font-weight: 700; color: #1e293b; }
.stat-card.warning .stat-value { color: #b91c1c; }

/* =========================================
   FUNCIONAMENTO
   ========================================= */
.funcionamento-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}
.ubs-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
    min-width: 0;
}
.ubs-card:hover {
    border-color: #2563eb;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.1);
    transform: translateY(-2px);
}
.ubs-title {
    margin: 0 0 12px 0;
    font-size: 16px;
    color: #111827;
    font-weight: 600;
    word-wrap: break-word;
}
.ubs-files-status {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.file-status {
    display: flex;
    justify-content: space-between;
    font-size: 13px;
    border-bottom: 1px dashed #e5e7eb;
    padding-bottom: 4px;
}
.file-status:last-child { border-bottom: none; padding-bottom: 0; }
.file-label { color: #4b5563; font-weight: 500; }
.file-date { color: #059669; font-weight: 600; }
.file-missing { color: #dc2626; font-weight: 600; }

.upload-group {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 16px;
}
.upload-group label { font-weight: 600; color: #374151; margin-bottom: 0; }

/* =========================================
   INDICADORES HUB
   ========================================= */
.indicadores-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}
.indicador-card {
    background: #fff;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    display: flex;
    gap: 16px;
    align-items: flex-start;
    transition: all 0.2s;
}
.indicador-card.active {
    border-color: #2563eb;
    cursor: pointer;
    box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.1);
}
.indicador-card.active:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 12px -2px rgba(37, 99, 235, 0.15);
}
.indicador-card.disabled {
    opacity: 0.7;
    background: #f9fafb;
    cursor: not-allowed;
}
.indicador-icon {
    font-size: 32px;
    background: #eff6ff;
    padding: 12px;
    border-radius: 12px;
    line-height: 1;
}
.indicador-content h3 {
    margin: 0 0 8px 0;
    font-size: 16px;
    color: #111827;
}
.indicador-content p {
    margin: 0 0 12px 0;
    font-size: 13px;
    color: #6b7280;
    line-height: 1.4;
}
.badge-ativo {
    background: #dcfce7;
    color: #15803d;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}
.badge-breve {
    background: #fef3c7;
    color: #92400e;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
}

/* =========================================
   INDICADORES (GESTAÇÃO E PUERPÉRIO)
   ========================================= */
.dashboard-indicadores {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.stat-card-indicadores {
    background: white;
    border-radius: 8px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.06);
    border-left: 5px solid #3b82f6;
    display: flex;
    flex-direction: column;
}
.stat-card-indicadores.green { border-left-color: #22c55e; }
.stat-card-indicadores.yellow { border-left-color: #eab308; }
.stat-card-indicadores.red { border-left-color: #ef4444; }

/* Cores do Card de Desempenho */
.card-regular { border-left-color: #ef4444 !important; }
.card-suficiente { border-left-color: #eab308 !important; }
.card-bom { border-left-color: #22c55e !important; }
.card-otimo { border-left-color: #3b82f6 !important; }

.stat-label-ind { font-size: 12px; text-transform: uppercase; color: #64748b; font-weight: 600; }
.stat-value-ind { font-size: 28px; font-weight: 700; color: #0b3b5c; margin: 4px 0; line-height: 1; }
.stat-sub-ind { font-size: 12px; color: #475569; }

.tabela-indicadores {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}
.tabela-indicadores th {
    text-align: left;
    padding: 10px 8px;
    background: #f1f5f9;
    color: #334155;
    font-weight: 600;
    border-bottom: 2px solid #e2e8f0;
    white-space: nowrap;
}
.tabela-indicadores td {
    padding: 8px;
    border-bottom: 1px solid #e2e8f0;
    vertical-align: middle;
}
.tabela-indicadores tr.clickable-row { cursor: pointer; transition: background 0.2s; }
.tabela-indicadores tr.clickable-row:hover td { background: #e0f2fe; }

.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 600; }
.tag-match { background: #dcfce7; color: #15803d; }
.tag-so-siaps { background: #fef9c3; color: #a16207; }
.tag-so-pec { background: #dbeafe; color: #1d4ed8; }

.ig-badge { display: inline-block; padding: 3px 8px; border-radius: 6px; font-size: 12px; font-weight: 700; background: #e0f2fe; color: #0369a1; }
.ig-badge.puerperio { background: #fce7f3; color: #be185d; }

/* Modal de Detalhes do Indicador */
.modal-content-ind {
    background: white;
    border-radius: 24px;
    width: 90%;
    max-width: 750px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 32px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
    position: relative;
    transform: scale(1);
    transition: transform 0.3s;
}
.modal-close {
    position: absolute;
    top: 16px; right: 16px;
    background: #f1f5f9; border: none;
    width: 36px; height: 36px; border-radius: 50%;
    font-size: 1.5rem; color: #64748b;
    cursor: pointer; display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
}
.modal-close:hover { background: #e2e8f0; color: #0f172a; }

.modal-header-ind { margin-bottom: 24px; border-bottom: 1px solid #e2e8f0; padding-bottom: 16px; }
.modal-title-ind { font-size: 1.4rem; font-weight: 700; color: #0b3b5c; margin-bottom: 8px; }
.modal-subtitle-ind { font-size: 0.9rem; color: #475569; display: flex; gap: 16px; flex-wrap: wrap; }

.bp-list-ind { display: flex; flex-direction: column; gap: 12px; }
.bp-item-ind {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 16px;
    display: flex;
    gap: 12px;
    align-items: flex-start;
}
.bp-status-icon { font-size: 1.4rem; line-height: 1; flex-shrink: 0; }
.bp-content-ind h4 { font-size: 1rem; color: #1e293b; margin-bottom: 4px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bp-content-ind p { font-size: 0.85rem; color: #64748b; line-height: 1.4; }
.bp-done { border-left: 4px solid #22c55e; background: #f0fdf4; }
.bp-missing { border-left: 4px solid #ef4444; background: #fef2f2; }
.bp-pending { border-left: 4px solid #eab308; background: #fefce8; }

.bp-tag-ind { font-size: 0.7rem; padding: 2px 6px; border-radius: 4px; font-weight: 600; text-transform: uppercase; }
.bp-tag-ind.done { background: #dcfce7; color: #15803d; }
.bp-tag-ind.missing { background: #fee2e2; color: #b91c1c; }
.bp-tag-ind.pending { background: #fef08a; color: #854d0e; }
.days-left { font-weight: 700; color: #b45309; }

/* Barras de Desempenho */
.bp-stat-item { background: #f8fafc; border-radius: 12px; padding: 12px; border: 1px solid #e2e8f0; }
.bp-stat-header { display: flex; justify-content: space-between; font-size: 0.9rem; font-weight: 600; margin-bottom: 8px; color: #334155; }
.bp-stat-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; }
.bp-stat-fill { height: 100%; border-radius: 4px; transition: width 0.6s ease; }
.bg-regular { background: #ef4444; }
.bg-suficiente { background: #eab308; }
.bg-bom { background: #22c55e; }
.bg-otimo { background: #3b82f6; }

.text-regular { color: #ef4444; }
.text-suficiente { color: #eab308; }
.text-bom { color: #22c55e; }
.text-otimo { color: #3b82f6; }

/* =========================================
   CALENDÁRIO
   ========================================= */
.calendar-container { background: #fff; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.06); padding: 24px; }
.calendar-header { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid #e5e7eb; }
.calendar-title h1 { margin: 0; font-size: 32px; font-weight: 700; color: #111827; }
.calendar-filter { display: flex; flex-direction: column; gap: 4px; }
.calendar-filter span { font-size: 12px; color: #4b5563; text-align: right; }
.calendar-filter select { padding: 6px 12px; border: 1px solid #d1d5db; border-radius: 4px; font-size: 14px; min-width: 200px; }
.calendar-legend { display: flex; flex-wrap: wrap; gap: 16px; margin-bottom: 20px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: #374151; text-transform: uppercase; }
.legend-color { display: inline-block; width: 12px; height: 12px; border-radius: 2px; }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); background: #fff; border-top: 1px solid #d1d5db; border-left: 1px solid #d1d5db; }
.weekday { background: #f3f4f6; padding: 12px 8px; text-align: left; font-weight: 700; font-size: 13px; color: #374151; border-right: 1px solid #d1d5db; border-bottom: 1px solid #d1d5db; }
.day-cell { min-height: 150px; padding: 6px; background: #fff; border-right: 1px solid #d1d5db; border-bottom: 1px solid #d1d5db; display: flex; flex-direction: column; cursor: pointer; transition: background 0.1s; }
.day-cell:hover:not(.empty-cell):not(.past-cell) { background: #f9fafb; }
.day-cell:nth-child(7n), .day-cell:nth-child(7n-1) { background: #f9fafb; }
.past-cell { background: #e5e7eb !important; cursor: not-allowed; opacity: 0.8; }
.empty-cell { background: #e5e7eb; cursor: default; }
.day-number { font-weight: 600; font-size: 13px; color: #374151; margin-bottom: 6px; align-self: flex-start; }

.events-container { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; max-height: 180px; }
.event-card { background: #fff; border-left: 4px solid #6b7280; padding: 4px 6px; margin-bottom: 2px; border-radius: 2px; box-shadow: 0 1px 2px rgba(0,0,0,0.08); cursor: pointer; transition: transform 0.1s, box-shadow 0.1s; }
.event-card:hover { box-shadow: 0 2px 4px rgba(0,0,0,0.15); transform: translateY(-1px); }
.ev-title { font-size: 10px; font-weight: 700; color: #111827; line-height: 1.2; margin-bottom: 2px; text-transform: uppercase; }
.ev-subtitle { font-size: 9px; color: #6b7280; line-height: 1.2; }
.ev-cancelado { text-decoration: line-through; opacity: 0.5; }

.cor-blue { border-left-color: #3b82f6; }
.cor-green { border-left-color: #10b981; }
.cor-red { border-left-color: #ef4444; }
.cor-cyan { border-left-color: #06b6d4; }
.cor-yellow { border-left-color: #eab308; }
.cor-purple { border-left-color: #a855f7; }
.cor-orange { border-left-color: #f97316; }
.cor-gray { border-left-color: #6b7280; }

.legend-color.cor-blue { background-color: #3b82f6; }
.legend-color.cor-green { background-color: #10b981; }
.legend-color.cor-red { background-color: #ef4444; }
.legend-color.cor-cyan { background-color: #06b6d4; }
.legend-color.cor-yellow { background-color: #eab308; }
.legend-color.cor-purple { background-color: #a855f7; }
.legend-color.cor-orange { background-color: #f97316; }
.legend-color.cor-gray { background-color: #6b7280; }

/* =========================================
   AVISOS / CHAMADOS (NOVOS ESTILOS)
   ========================================= */
.avisos-page { max-width: 900px; margin: 0 auto; }

/* Cores auxiliares */
.text-blue { color: #2563eb; }
.text-yellow { color: #d97706; }
.text-green { color: #16a34a; }
.text-purple { color: #9333ea; }

/* Dashboard */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
    margin-bottom: 24px;
}
.stat-box {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}
.stat-num {
    display: block;
    font-size: 28px;
    font-weight: 700;
    line-height: 1.1;
    margin-bottom: 4px;
}
.stat-label {
    font-size: 12px;
    color: #6b7280;
    font-weight: 500;
    text-transform: uppercase;
}

.aviso-form {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.aviso-form textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.aviso-card {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}

/* Topo: Mensagem e Botão Excluir */
.aviso-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
}

.aviso-mensagem {
    font-size: 15px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
    color: #111827;
    flex: 1;
}

.aviso-btn-excluir {
    padding: 4px 10px;
    font-size: 12px;
    flex-shrink: 0;
}

/* Autor e Lotação (Discreto) */
.aviso-autor-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 16px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #6b7280;
}

.aviso-avatar-small {
    width: 28px; 
    height: 28px;
    border-radius: 50%;
    background: #e5e7eb;
    color: #4b5563;
    display: flex; 
    align-items: center; 
    justify-content: center;
    font-weight: 700; 
    font-size: 11px;
    flex-shrink: 0;
}

.aviso-autor-texto strong {
    color: #374151;
    font-weight: 600;
}

/* Status Badges e Selects */
.status-select {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid transparent;
    cursor: pointer;
    outline: none;
}
.status-badge {
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 700;
}

.status-aberto { background: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.status-andamento { background: #fef3c7; color: #b45309; border-color: #fcd34d; }
.status-fechado { background: #dcfce7; color: #15803d; border-color: #86efac; }

/* Ações: Data, Like e Comentários */
.aviso-acoes {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
    font-size: 12px;
    flex-wrap: wrap;
    position: relative;
}
.aviso-data { 
    color: #9ca3af; 
    font-size: 12px; 
    margin-right: auto; 
}

.btn-like {
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 20px;
    padding: 4px 12px;
    font-size: 13px;
    cursor: pointer;
    color: #374151;
    transition: all 0.15s;
}
.btn-like:hover { background: #f3f4f6; }
.btn-like.liked { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; font-weight: 600; }

.btn-comentar {
    background: transparent;
    border: none;
    cursor: pointer;
    color: #6b7280;
    font-size: 13px;
    padding: 4px 8px;
}
.btn-comentar:hover { color: #2563eb; text-decoration: underline; }

/* Popup de Curtidas */
.curtidas-popup {
    position: absolute;
    bottom: 100%;
    left: 0;
    margin-bottom: 8px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 10px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 50;
    min-width: 200px;
    max-width: 300px;
    max-height: 200px;
    overflow-y: auto;
}
.curtidas-popup ul { list-style: none; padding: 0; margin: 0; }
.curtidas-popup li { padding: 4px 0; border-bottom: 1px solid #f3f4f6; color: #4b5563; font-size: 12px; line-height: 1.4; }
.curtidas-popup li:last-child { border-bottom: none; }

/* Comentários */
.aviso-comentarios {
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #f3f4f6;
}
.comentario {
    display: flex;
    gap: 8px;
    align-items: flex-start;
    padding: 6px 0;
}
.comentario-body {
    background: #f9fafb;
    border-radius: 10px;
    padding: 10px 14px;
    flex: 1;
    font-size: 13px;
    line-height: 1.45;
    min-width: 0;
}
.comentario-body strong { display: block; font-size: 12px; color: #374151; margin-bottom: 2px; }
.comentario-body small { display: block; font-size: 11px; color: #9ca3af; margin-top: 4px; }
.btn-del-min {
    background: transparent;
    border: none;
    color: #9ca3af;
    cursor: pointer;
    font-size: 18px;
    padding: 2px 6px;
    line-height: 1;
}
.btn-del-min:hover { color: #dc2626; }

.comentario-input { display: flex; gap: 8px; margin-top: 10px; }
.comentario-input input {
    flex: 1;
    padding: 8px 14px;
    border: 1px solid #d1d5db;
    border-radius: 20px;
    font-size: 13px;
    box-sizing: border-box;
}

/* Paginação */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
}
.page-info {
    font-size: 14px;
    color: #4b5563;
    font-weight: 500;
}
.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Menções Dropdown */
.mention-dropdown {
    position: absolute;
    top: 100%;
    left: 16px;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,0.1);
    z-index: 100;
    max-height: 200px;
    overflow-y: auto;
    min-width: 250px;
    margin-top: 4px;
}
.mention-item {
    padding: 10px 14px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid #f3f4f6;
}
.mention-item:hover {
    background: #eff6ff;
}
.mention-item strong {
    color: #1f2937;
}
.mention-item span {
    color: #6b7280;
    font-size: 12px;
}

/* =========================================
   RESPONSIVIDADE
   ========================================= */
@media (max-width: 1200px) {
    .dashboard-bottom-grid {
        grid-template-columns: repeat(2, 1fr); /* 2 colunas no tablet */
    }
}

@media (max-width: 1024px) {
    .dashboard-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
    /* Layout Geral */
    main { padding: 12px; }
    .topbar { padding: 12px; }
    .topbar .user { display: none; }

    .panel-header { flex-direction: column; align-items: flex-start; }
    .panel-header > div { flex-wrap: wrap; }

    /* Dashboard */
    .dashboard-container { gap: 16px; }
    .dashboard-grid,
    .dashboard-bottom-grid {
        grid-template-columns: 1fr !important;
        gap: 16px;
    }
    .dash-events-list {
        max-height: none;
        overflow-y: visible;
        padding-right: 0;
    }
    .dash-header-flex {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .flex-ev {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    .flex-date {
        flex-direction: row;
        border-right: none;
        border-bottom: 1px solid #e5e7eb;
        padding-right: 0;
        padding-bottom: 4px;
        width: 100%;
        justify-content: flex-start;
        gap: 12px;
    }

    /* Indicadores Hub */
    .indicadores-grid {
        grid-template-columns: 1fr;
    }
    .indicador-card {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    /* Funcionamento */
    .funcionamento-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    .ubs-card {
        padding: 16px;
        width: 100%;
    }

    /* Indicadores - Dashboard */
    .dashboard-indicadores {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
        gap: 12px;
    }
    .stat-card-indicadores {
        padding: 12px;
    }
    .stat-value-ind {
        font-size: 24px;
    }

    /* Modais */
    .modal, .modal-content-ind {
        width: 100%;
        max-height: 100vh;
        border-radius: 12px;
        padding: 20px;
    }
    
    /* Calendário */
    .calendar-container { padding: 12px; }
    .calendar-grid { grid-template-columns: repeat(7, 1fr); }
    .day-cell { min-height: 90px; padding: 4px; }
    .weekday { font-size: 10px; padding: 8px 2px; }
    .event-card { padding: 2px 4px; }
    .ev-title { font-size: 8px; }
    .ev-subtitle { display: none; }
    .calendar-header { flex-direction: column; align-items: flex-start; gap: 12px; }
    .calendar-filter span { text-align: left; }
    .calendar-filter select { width: 100%; }

    /* Tabelas */
    .tabela {
        display: block;
        overflow-x: auto;
        white-space: nowrap;
    }

    /* Avisos */
    .aviso-card { padding: 16px; }
    .aviso-top { flex-direction: column; gap: 8px; }
    .aviso-mensagem { font-size: 14px; }
    .aviso-acoes { gap: 8px; }
    .aviso-data { width: 100%; order: 99; margin-right: 0; }
    .aviso-autor-info { flex-direction: column; align-items: flex-start; gap: 8px; }
    
    /* Avisos - Dashboard de Estatísticas */
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
}