@import url('./sidebar.css');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --sidebar-w: 320px;
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #2b2f36;
  --muted: #6b7280;
  --border: #e6e9ee;
  --brand: #0a4b63;
  --warn-bg: #fff8e1;
  --warn-border: #ffc107;
  --line: #e5e7eb;
  --sidebarbackground: #ffffff;

  --paho-light-blue: #009dde;
  --paho-dark-blue: #236192;
  --paho-orange: #f6711f;

  --paho-primary: #0b5c7a;
  --paho-primary-2: #0a4b63;
}

body {
  font-family:
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    Helvetica,
    Arial,
    'Apple Color Emoji',
    'Segoe UI Emoji';
  color: var(--text);
  background: var(--bg);
}

/* SIDEBAR FIXA */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, var(--paho-primary), var(--paho-primary-2));
  border-right: 1px solid var(--border);
  padding: 18px 10px;
  overflow: hidden;
  padding-top: 0;
  display: flex;
  flex-direction: column;
}

.brand {
  margin-bottom: 18px;
}

.logo-box {
  display: flex;
  align-items: center;
  height: 120px;
  border-radius: 10px;
  margin-bottom: 10px;
}

.logo-placeholder {
  color: var(--muted);
  font-weight: bold;
}

.brand-title {
  font-weight: 800;
  color: var(--sidebarbackground);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 10px;
  flex: 1;
  min-height: 0;
  position: relative;
}

.label {
  font-size: 12px;
  color: var(--sidebarbackground);
  margin-top: 6px;
}

.input {
  width: 100%;
  padding: 10px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  outline: none;
  background: #fff;
}

.input:focus {
  border-color: #b8c9dc;
}

.search-results {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  max-height: min(34vh, 320px);
  overflow-y: auto;
}

#search-results {
  position: absolute;
  z-index: 40;
  left: 0;
  top: var(--search-results-top, 0px);
  width: 100%;
  min-height: 0;
}

.search-results:empty {
  display: none;
}

.search-results li {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  font-size: 14px;
}

.search-results li:last-child {
  border-bottom: none;
}

.search-results li:hover {
  background: #f1f5f9;
}

.search-open-btn {
  text-align: left;
  cursor: pointer;
}

.filters {
  display: grid;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.btn {
  padding: 10px 12px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  font-weight: 700;
}

.btn-ghost {
  background: transparent;
  color: #fff;
  border: 1px solid var(--border);
}

/* MAIN */
.main {
  margin-left: var(--sidebar-w);
  padding: 18px;
}

.header {
  background: var(--brand);
  color: #fff;
  padding: 18px;
  border-radius: 12px;
  margin-bottom: 18px;
}

.header h1 {
  font-size: 22px;
  margin-bottom: 4px;
}

.header p {
  opacity: 0.9;
  font-size: 14px;
}

.card {
  background: var(--bg);
  border-radius: 12px;
  margin-block: 20px;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.2px;
}

.card h2 {
  margin-bottom: 12px;
  color: var(--brand);
}

.item {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px;
  background: #fff;
  margin-block: 8px;
}

.item:last-child {
  border-bottom: none;
}

.item h3 {
  font-size: 15px;
  margin-bottom: 6px;
}

.meta {
  color: var(--muted);
  margin-top: 6px;
}

.disclaimer {
  background: var(--warn-bg);
  padding: 14px;
  border-left: 6px solid var(--warn-border);
  border-radius: 10px;
  font-size: 13px;
  margin-block: 10px;
}

img.brand-logo {
  display: block;
  height: 72px;
  width: 220px;
  max-width: 100%;
  object-fit: contain;
}

/* mini cards */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

@media (max-width: 1100px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }
}

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

.metric-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
}

.metric-card .k {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.metric-card .v {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
}

.metric-card .hint {
  font-size: 11px;
  color: var(--muted);
  margin-top: 6px;
}

.chart-wrapper {
  max-width: 700px;
  margin: 0 auto 30px auto;
}

/* KPI CARDS */
.metric-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  background: linear-gradient(135deg, #f7fbff, #ffffff);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

.metric-card .k {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.metric-card .v {
  font-size: 18px;
  font-weight: 800;
  color: var(--brand);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

@media (max-width: 1100px) {
  .metrics-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

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

/* INFO GRID */
.nsa-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 10px;
}

.field {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}

.field_fiscal {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px 18px 16px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
  width: 150px;
}

.field h3 {
  margin: 0 0 14px;
  font-size: 16px;
  font-weight: 600;
  color: #0f172a;
}

.field h5 {
  margin: 18px 0 6px;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field h5:first-of-type {
  margin-top: 0;
}

.field .kv {
  margin: 0;
  font-size: 14px;
  line-height: 1.6;
  color: #111827;
  white-space: pre-line;
  word-break: break-word;
}

.field .kv {
  max-height: 160px;
  overflow: auto;
  padding-right: 6px;
}

.field .kv::-webkit-scrollbar {
  width: 6px;
}

.field .kv::-webkit-scrollbar-thumb {
  background: #e5e7eb;
  border-radius: 10px;
}

.field h5 + .kv {
  padding-bottom: 12px;
}

.field h5:last-of-type + .kv {
  border-bottom: none;
  padding-bottom: 0;
}

@media (max-width: 768px) {
  .field {
    padding: 14px;
  }

  .field .kv {
    font-size: 13px;
    max-height: 140px;
  }
}

/* SEÇÕES COLAPSÁVEIS */
.section {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  padding: 10px 12px;
  margin-top: 10px;
}

.section summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--brand);
  list-style: none;
}

.section summary::-webkit-details-marker {
  display: none;
}

.section .content {
  margin-top: 10px;
  white-space: pre-wrap;
  line-height: 1.5;
  color: var(--text);
}

.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 6;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 6px 12px;
  margin-top: 8px;
}

.kv dt {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.kv dd {
  margin: 0;
  font-size: 14px;
  word-break: break-word;
}

.kv a {
  color: var(--brand);
  text-decoration: none;
}

.kv a:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
  margin: 6px 0 0;
}

.lead {
  color: var(--muted);
}

.chart-wrapper {
  position: relative;
  height: clamp(320px, 42vh, 460px);
}

@media (max-width: 768px) {
  .chart-wrapper {
    height: 320px;
  }
}

.no-financial-data {
  padding: 16px;
  text-align: center;
  color: #666;
  font-size: 14px;
}

/* footer */
.app-footer {
  margin-top: 40px;
  padding: 16px 24px;
  border-top: 1px solid #e5e7eb;
  background: #fff;
  font-size: 13px;
  color: #6b7280;
  text-align: center;
}

.none {
  display: none !important;
}

.language-link {
  display: flex;
  font-size: 1rem;
  justify-content: flex-end;
  gap: 4px;
  margin-bottom: 5px;
  position: sticky;
  top: 0;
  color: #00205c;
  z-index: 1;
}

.lang-toggle {
  cursor: pointer;
}

.lang-toggle:hover {
  text-decoration: underline;
  text-decoration-thickness: 2px;
}

/* Container do "On this page" */
.on-this-page {
  padding: 1rem 0;
  font-size: 0.95rem;
  color: #fff;
}

/* Título */
.on-this-page h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #236192;
  font-weight: 600;
}

/* Lista */
.on-this-page ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* Link base */
.on-this-page a {
  display: block;
  text-decoration: none;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid transparent;
  color: var(--sidebarbackground);
  border-radius: 4px;
  transition: all 0.2s ease;
  font-weight: 500;
}

/* Hover */
.on-this-page a:hover {
  background-color: rgba(52, 152, 219, 0.08);
  color: var(--sidebarbackground);
  border-left: 3px solid #3498db;
}

/* Link ativo */
.on-this-page a.active {
  background-color: rgba(35, 97, 146, 0.08);
  color: #236192;
  border-left: 3px solid #ff671f;
  font-weight: 600;
}

#navTitle {
  font-weight: 800;
  color: var(--sidebarbackground);
  margin-top: auto;
  padding-top: 10px;
}

/* === LABEL LAYOUT FOR AGENDA / STRATEGIC PLAN CARDS === */
#collabWPActHealthAgendaObj,
#strategicPlan,
#card03,
#card04 {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 12px 10px;
}

#collabWPActHealthAgendaObj h3,
#strategicPlan h3,
#card03 h3,
#card04 h3 {
  flex: 0 0 100%;
  margin: 0 0 8px;
}

.list-tag {
  list-style: none;
  padding: 0;
  margin: 0;
  display: inline-block;
}

.list-tag li {
  margin: 0;
  line-height: 1.3;
}

.tag {
  display: inline-flex;
  align-items: center;
  background: #e6f0f7;
  color: #0b5aa6;
  padding: 10px 18px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  margin: 0;
  max-width: 100%;
  white-space: normal;
}

:root:has(#profileTitle:target) #profileTitlenav,
:root:has(#uiFinTitle:target) #financialnav,
:root:has(#collaborationWithPAHO:target) #CollaborationNav {
  color: #ff671f;
  font-weight: 700;
  text-underline-offset: 0.15em;
}

.subtitle {
  font-size: 1.15rem;
  font-weight: 600;
  color: #1f2d3d;
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #e3e8ef;
  letter-spacing: 0.3px;
}

#wpTitle {
  margin: 0;
}