:root {
  --blue: #075b9a;
  --blue-he: #075b9a;
  --blue-hcal: #09a7bd;
  --green: #00a859;
  --green-he: #007a3d;
  --green-hcal: #7ac943;
  --purple: #5e35b1;
  --avg-hd: #D4A017;
  --bg: #f4f8fb;
  --text: #0c2746;
  --muted: #667b91;
  --card: #ffffff;
  --line: #dbe7f0;
  --shadow: 0 12px 28px rgba(9, 42, 75, 0.1);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: Inter, Segoe UI, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 260px;
  background: linear-gradient(180deg, #075b9a, #07598d 58%, #07547f);
  color: #fff;
  padding: 36px 12px 22px;
  position: fixed;
  inset: 0 auto 0 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 20;
}
.brand {
  background: #fff;
  border-radius: 20px;
  padding: 18px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  min-height: 74px;
}
.brand-logo-img {
  width: 95px;
  max-height: 55px;
  object-fit: contain;
  flex: 0 0 auto;
}
.brand-text strong {
  display: block;
  color: var(--blue);
  font-size: 20px;
  line-height: 1;
  font-weight: 900;
}
.brand-text span {
  color: #0b79bf;
  display: block;
  font-size: 14px;
  margin-top: 8px;
}
.nav-btn {
  border: 0;
  border-radius: 13px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  text-align: left;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
}
.nav-btn span { font-size: 18px; line-height: 1; }
.nav-btn.active,
.nav-btn:hover {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.10);
}
.sidebar-footer {
  margin-top: auto;
  border-top: 1px solid rgba(255, 255, 255, 0.45);
  padding: 24px 10px 0;
  display: flex;
  gap: 12px;
  font-size: 15px;
  line-height: 1.45;
}
.content {
  margin-left: 260px;
  width: calc(100% - 260px);
  padding: 22px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
}
.topbar h1 { margin: 0; font-size: 28px; line-height: 1.2; }
.filters { display: flex; align-items: center; gap: 10px; }
.filters label { font-weight: 800; }
select {
  border: 1px solid #cbd9e6;
  border-radius: 12px;
  padding: 13px 48px 13px 14px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
  box-shadow: 0 4px 10px rgba(9, 42, 75, 0.08);
}
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 20px 26px;
  display: flex;
  align-items: center;
  gap: 24px;
  min-height: 112px;
  overflow: hidden;
  position: relative;
}
.card:before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--blue); }
.card-hd:before { background: var(--blue); }
.card-cdl:before { background: var(--green); }
.card-patients:before { background: var(--purple); }
.card-avgHd:before { background: var(--avg-hd); }
.card-avgHd .card-icon { color: var(--avg-hd); background: #fff7df; }
.card-avgHd small { color: var(--avg-hd); }
.card-avgHd strong { color: var(--avg-hd); }

.card-icon {
  width: 78px;
  height: 78px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
}
.card-icon svg { width: 54px; height: 54px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.card-hd .card-icon { color: var(--blue); background: #e7f2fb; }
.card-cdl .card-icon { color: var(--green); background: #e7f7ec; }
.card-patients .card-icon { color: var(--purple); background: #f0eafb; }
.card small { color: var(--blue); font-weight: 900; font-size: 16px; display: block; }
.card-cdl small { color: var(--green); }
.card-patients small { color: var(--purple); }
.card strong { display: block; font-size: 38px; line-height: 1; margin: 8px 0 6px; color: var(--blue); }
.card-cdl strong { color: var(--green); }
.card-patients strong { color: var(--purple); }
.card span { color: var(--text); font-size: 14px; }
.grid.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 18px;
  min-width: 0;
}
.panel h2,
.section-title h2 { margin: 0 0 14px; font-size: 17px; display: flex; align-items: center; gap: 10px; }
.section-title { display: flex; justify-content: space-between; align-items: end; margin: 6px 0 16px; }
.section-title span { color: var(--muted); font-weight: 700; }
.title-icon { width: 38px; height: 38px; border-radius: 14px; display: inline-grid; place-items: center; flex: 0 0 auto; }
.title-icon svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.icon-hd { background: #e7f2fb; color: var(--blue); }
.icon-cdl { background: #e7f7ec; color: var(--green); }
.icon-patients { background: #f0eafb; color: var(--purple); }
.chart { min-height: 300px; width: 100%; overflow: hidden; }
.chart svg { display: block; width: 100%; max-width: 100%; height: auto; aspect-ratio: 900 / 310; }
.bar-label { font-size: 12px; fill: #183650; font-weight: 800; }
.axis { stroke: #d7e4ee; stroke-width: 1; }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 10px; }
table { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; min-width: 560px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th, td { padding: 13px 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); text-align: center; vertical-align: middle; white-space: nowrap; }
th:last-child, td:last-child { border-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
th { background: #f8fbfe; color: var(--text); font-size: 12px; font-weight: 900; }
td:first-child, th:first-child { text-align: left; }
td.num { font-weight: 900; color: var(--blue); font-size: 15px; }
.table-total td { background: #eef6fb; font-weight: 900; }
.table-hd { color: var(--blue); }
.table-cdl { color: var(--green); }
.table-patients { color: var(--purple); }
.table-icon { display: inline-flex; align-items: center; justify-content: center; vertical-align: middle; margin-right: 6px; }
.table-icon svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.hospital-dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; margin-right: 8px; }
.dot-he { background: var(--blue-he); }
.dot-hcal { background: var(--blue-hcal); }
@media (max-width: 1120px) {
  .cards { grid-template-columns: 1fr; }
  .grid.two { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  body { display: block; min-height: 100dvh; }
  .sidebar {
    position: sticky;
    top: 0;
    width: 100%;
    padding: 10px;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 18px 18px;
  }
  .brand { flex: 1 0 100%; justify-content: center; margin: 0; padding: 10px 12px; min-height: auto; }
  .brand-logo-img { width: 70px; max-height: 36px; }
  .brand-text strong { font-size: 18px; }
  .brand-text span { font-size: 12px; margin-top: 5px; }
  .nav-btn { flex: 1 1 0; justify-content: center; min-width: 0; padding: 10px 5px; font-size: 12px; white-space: nowrap; }
  .nav-btn span { display: none; }
  .sidebar-footer { display: none; }
  .content { margin-left: 0; width: 100%; padding: 12px; }
  .topbar { display: block; margin-bottom: 16px; }
  .topbar h1 { font-size: 22px; }
  .filters { margin-top: 12px; width: 100%; }
  .filters select { width: 100%; }
  .card { padding: 14px 14px 14px 18px; gap: 14px; min-height: 94px; }
  .card-icon { width: 62px; height: 62px; }
  .card-icon svg { width: 42px; height: 42px; }
  .card small { font-size: 14px; }
  .card strong { font-size: 30px; }
  .panel { padding: 12px; }
  .chart { min-height: 0; overflow: visible; }
  .bar-label { font-size: 9px; }
  table { min-width: 0; table-layout: fixed; font-size: 11px; }
  th, td { padding: 9px 4px; white-space: normal; }
  .table-icon { display: block; margin: 0 auto 2px; }
  .table-icon svg { width: 20px; height: 20px; }
  td.num { font-size: 12px; }
}
@media (max-width: 420px) {
  .nav-btn { font-size: 11px; }
  .topbar h1 { font-size: 19px; }
  .card strong { font-size: 28px; }
  .panel h2 { font-size: 15px; }
  .bar-label { font-size: 8px; }
}

.dashboard-title{margin:0;font-size:52px;font-weight:900;text-transform:uppercase;letter-spacing:6px;color:#00A859;line-height:1.1;}
.topbar{background:#ffffff;border:1px solid #dbe7f0;border-radius:26px;padding:28px 26px;display:flex;justify-content:space-between;align-items:center;gap:20px;box-shadow:0 8px 20px rgba(0,0,0,.05);margin-bottom:24px;}
@media (max-width:768px){.dashboard-title{font-size:20px;letter-spacing:2px;text-align:center;}}


/* Ajustes finais solicitados: 4 cards no resumo geral e título/ano empilhados no celular */
@media (min-width: 1121px) {
  #generalCards {
    grid-template-columns: repeat(4, minmax(180px, 1fr));
  }
}

@media (max-width: 768px) {
  .topbar {
    display: flex !important;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 18px;
    padding: 26px 18px;
  }

  .topbar h1,
  .dashboard-title {
    width: 100%;
    text-align: center;
    font-size: 24px;
    line-height: 1.25;
    letter-spacing: 3px;
  }

  .filters {
    width: 100%;
    margin-top: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
  }

  .filters label {
    font-size: 18px;
    font-weight: 900;
  }

  .filters select {
    width: 220px;
    max-width: 100%;
    text-align: center;
  }

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

@media (max-width: 420px) {
  .topbar h1,
  .dashboard-title {
    font-size: 20px;
    letter-spacing: 2px;
  }
}

.card-avgHd:before{background:#D4A017!important;}.card-avgHd .card-icon{background:#FFF6D8!important;color:#D4A017!important;}.card-avgHd small,.card-avgHd strong{color:#D4A017!important;}.card-avgHd svg{stroke:#D4A017!important;fill:none;stroke-width:2.5;}