:root {
  --pt-lavanda: #848FEC;
  --pt-institutional: #373F8A;
  --pt-deep: #141856;
  --pt-graphite: #1B1B1B;
  --pt-gray: #F3F3F3;
  --pt-white: #FCFFFF;
  --pt-error: #E53E3E;
  --pt-success: #3BA169;
  --pt-alert: #ED8936;
  --pt-link: #31B2CE;
  --sidebar-width: 240px;
  --header-height: 64px;
}

* { font-family: 'Roboto', system-ui, sans-serif; box-sizing: border-box; }
html, body { margin: 0; background-color: var(--pt-gray); color: var(--pt-graphite); }

h1, h2, h3, h4, p { margin: 0; font-family: 'Roboto', system-ui, sans-serif; }

.card {
  background: var(--pt-white);
  border: 1px solid rgba(55, 63, 138, 0.08);
  border-radius: 10px;
  box-shadow: 0 1px 3px rgba(20, 24, 86, 0.06);
}

.btn-primary {
  background-color: var(--pt-institutional); color: white; border: none;
  border-radius: 8px; padding: 8px 16px; font-size: 14px; font-weight: 500;
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: background-color .15s ease, box-shadow .15s ease;
}
.btn-primary:hover { background-color: #2d3478; box-shadow: 0 2px 8px rgba(55,63,138,.3); }

.btn-secondary {
  background: transparent; color: var(--pt-institutional);
  border: 1.5px solid var(--pt-institutional); border-radius: 8px;
  padding: 8px 16px; font-size: 14px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; transition: all .15s ease;
  text-decoration: none;
}
.btn-secondary:hover { background-color: rgba(55,63,138,.06); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

.badge {
  display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 100px;
  font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  gap: 3px;
}
.badge-success { background: rgba(59,161,105,.12); color: #2d8a5a; }
.badge-error   { background: rgba(229,62,62,.10); color: #c53030; }
.badge-alert   { background: rgba(237,137,54,.12); color: #c05621; }
.badge-blue    { background: rgba(132,143,236,.15); color: var(--pt-institutional); }
.badge-gray    { background: rgba(55,63,138,.08); color: #6b7280; }

.kpi-warning { margin-top: 6px; font-size: 11px; line-height: 1.4; color: #c05621; }
.kpi-info-note { margin-top: 6px; font-size: 11px; line-height: 1.4; color: #8992a3; }

.progress-bar { height: 6px; border-radius: 100px; background: rgba(55,63,138,.1); overflow: hidden; }
.progress-bar-fill { height: 100%; border-radius: 100px;
  background: linear-gradient(90deg, var(--pt-lavanda), var(--pt-institutional));
  transition: width .6s ease; }

.sidebar {
  position: fixed; top: 0; left: 0; width: var(--sidebar-width); height: 100vh;
  background: var(--pt-deep); display: flex; flex-direction: column; z-index: 20;
}
.sidebar-top { padding: 24px 20px 18px; }
.sidebar-logo { width: 140px; height: auto; display: block; }
.sidebar-tagline { display: block; margin-top: 6px; font-size: 11px; color: rgba(255,255,255,.4); }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 12px; }
.nav-group { margin-bottom: 18px; }
.nav-group-label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: rgba(255,255,255,.35); padding: 6px 10px 8px;
}
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 8px; color: rgba(255,255,255,.55);
  text-decoration: none; font-size: 13.5px; font-weight: 500; margin-bottom: 2px;
  transition: background-color .15s ease, color .15s ease;
}
.nav-item:hover { background: rgba(255,255,255,.06); }
.nav-item.active { background: rgba(132,143,236,.18); color: var(--pt-lavanda); font-weight: 700; }
.nav-icon { display: inline-flex; }
.nav-indicator {
  position: absolute; left: 0; width: 3px; height: 18px;
  background: var(--pt-lavanda); border-radius: 0 2px 2px 0;
}

.sidebar-footer {
  display: flex; align-items: center; gap: 10px; padding: 16px 16px 20px;
  border-top: 1px solid rgba(255,255,255,.08);
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--pt-lavanda);
  color: var(--pt-deep); display: flex; align-items: center; justify-content: center;
  font-size: 12.5px; font-weight: 700; flex-shrink: 0;
}
.avatar-sm { width: 30px; height: 30px; font-size: 11px; background: var(--pt-institutional); color: white; }
.sidebar-user { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 700; color: white; line-height: 1.3; }
.sidebar-user-role {
  font-size: 11px; color: rgba(255,255,255,.45); line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sidebar-logout-form { flex-shrink: 0; }
.sidebar-logout-btn {
  width: 30px; height: 30px; border-radius: 50%; border: none; background: transparent;
  color: rgba(255,255,255,.55); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: background-color .15s ease, color .15s ease;
}
.sidebar-logout-btn:hover { background: rgba(255,255,255,.08); color: white; }

.header {
  position: fixed; top: 0; left: var(--sidebar-width); right: 0; height: var(--header-height);
  background: var(--pt-white); border-bottom: 1px solid rgba(20,24,86,.06);
  box-shadow: 0 1px 4px rgba(20,24,86,.04);
  display: flex; align-items: center; gap: 12px; padding: 0 28px; z-index: 10;
}
.header-spacer { flex: 1; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 50%; border: 1px solid rgba(55,63,138,.12);
  background: white; color: var(--pt-institutional); display: flex; align-items: center;
  justify-content: center; cursor: pointer;
}
.icon-btn:hover { background: rgba(55,63,138,.06); }

.btn-primary:disabled { opacity: .65; cursor: not-allowed; }
.btn-primary:disabled:hover { background-color: var(--pt-institutional); box-shadow: none; }
.refresh-icon.spinning { animation: refresh-spin .8s linear infinite; }
@keyframes refresh-spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.refresh-block { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.refresh-caption { font-size: 11px; line-height: 1.3; color: #8992a3; white-space: nowrap; }
.refresh-caption.refresh-caption-error { color: var(--pt-error); }

.period-filter { display: flex; align-items: center; gap: 10px; }
.pill-group { display: flex; gap: 6px; }
.pill {
  border: 1.5px solid rgba(55,63,138,.14); background: transparent; color: #6b7280;
  border-radius: 100px; padding: 6px 14px; font-size: 12.5px; font-weight: 500;
  cursor: pointer; transition: all .15s ease;
}
.pill:hover { background: rgba(55,63,138,.05); }
.pill-active {
  border-color: var(--pt-institutional); background: rgba(55,63,138,.06);
  color: var(--pt-institutional); font-weight: 600;
}
.date-range { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: #6b7280; }
.date-range-hidden { display: none; }
.date-range input[type="month"] {
  border: 1.5px solid rgba(55,63,138,.14); border-radius: 6px; padding: 5px 8px; font-size: 12.5px;
  font-family: 'Roboto', system-ui, sans-serif; color: var(--pt-graphite);
}
.btn-apply { padding: 5px 12px; font-size: 12.5px; }

.dimension-filter { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.dimension-filter-field { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #6b7280; }
.dimension-filter-select {
  border: 1.5px solid rgba(55,63,138,.14); border-radius: 6px; padding: 5px 8px; font-size: 12.5px;
  font-family: 'Roboto', system-ui, sans-serif; color: var(--pt-graphite); background: #fff; min-width: 160px;
}
.dimension-filter-clear { font-size: 12.5px; color: var(--pt-institutional); font-weight: 600; text-decoration: none; }
.dimension-filter-clear:hover { text-decoration: underline; }
.dimension-filter-note { margin: -8px 0 18px; font-size: 11px; line-height: 1.4; color: #c05621; max-width: 720px; }

.content { margin-left: var(--sidebar-width); margin-top: var(--header-height); padding: 24px 28px; min-height: calc(100vh - var(--header-height)); }
.page-heading { margin-bottom: 20px; }
.page-heading h1 { font-size: 20px; font-weight: 900; color: var(--pt-deep); }
.page-subtitle { font-size: 13px; color: #6b7280; margin-top: 4px; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(2, 1fr); } }

.kpi-card { padding: 18px 20px; }
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 14px; }
.kpi-label {
  display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: #8992a3;
}
.kpi-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block; }
.kpi-icon { color: #c8cdd8; flex-shrink: 0; }

.kpi-value-row { display: flex; align-items: baseline; gap: 3px; margin-bottom: 10px; }
.kpi-value { font-size: 34px; font-weight: 900; color: var(--pt-deep); letter-spacing: -0.03em; line-height: 1; }
.kpi-suffix { font-size: 18px; font-weight: 700; color: #9aa1b0; }

.kpi-progress-label { margin-top: 8px; font-size: 11.5px; color: #6b7280; font-weight: 500; }

.area-summary-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 1000px) { .area-summary-grid { grid-template-columns: 1fr; } }

.area-summary-card { padding: 18px 20px; }
.area-summary-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.area-summary-head h2 { font-size: 15px; font-weight: 900; color: var(--pt-deep); }

.area-accordion { margin-bottom: 14px; }
.area-accordion .area-summary-head {
  cursor: pointer; list-style: none; margin-bottom: 0;
  padding: 14px 18px; border-radius: 10px; background: #fff;
  border: 1px solid rgba(55,63,138,.08);
}
.area-accordion .area-summary-head::-webkit-details-marker { display: none; }
.area-accordion-toggle { display: flex; align-items: center; gap: 10px; }
.area-accordion-chevron { color: #8992a3; flex-shrink: 0; transition: transform .18s ease; }
.area-accordion[open] .area-accordion-chevron { transform: rotate(90deg); }
.area-accordion[open] .area-summary-head { border-radius: 10px 10px 0 0; border-bottom: none; }
.area-accordion .area-tiers {
  margin-top: 14px; padding: 16px 18px 20px; border: 1px solid rgba(55,63,138,.08);
  border-top: none; border-radius: 0 0 10px 10px;
  display: flex; flex-direction: column; gap: 20px;
}

.indicator-tier { border-left: 3px solid transparent; padding-left: 14px; }
.indicator-tier .kpi-grid { margin-bottom: 0; }
.indicator-tier-label {
  font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  margin-bottom: 12px;
}
.indicator-tier-estrategico { border-left-color: var(--pt-institutional); }
.indicator-tier-estrategico .indicator-tier-label { color: var(--pt-institutional); }
.indicator-tier-tatico { border-left-color: var(--pt-lavanda); }
.indicator-tier-tatico .indicator-tier-label { color: var(--pt-lavanda); }
.indicator-tier-operacional { border-left-color: #8992a3; }
.indicator-tier-operacional .indicator-tier-label { color: #8992a3; }

.area-summary-rows { display: flex; flex-direction: column; gap: 10px; }
.area-summary-row {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 10px; border-bottom: 1px solid rgba(55,63,138,.06);
  font-size: 13px;
}
.area-summary-row:last-child { border-bottom: none; padding-bottom: 0; }
.area-summary-row-label { display: flex; align-items: center; gap: 8px; color: #4b5262; }
.area-summary-row-value { font-weight: 700; color: var(--pt-deep); }
.area-summary-row-not-connected { font-weight: 400; font-style: italic; color: #8992a3; }

.chart-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
@media (max-width: 1000px) { .chart-grid { grid-template-columns: 1fr; } }

.chart-card { padding: 18px 20px 12px; }
.chart-card-head { margin-bottom: 6px; }
.chart-title { font-size: 13px; font-weight: 700; color: var(--pt-deep); }
.chart-subtitle { font-size: 11px; color: #8992a3; margin-top: 2px; }
.chart-plot { width: 100%; height: 260px; }
.snapshot-note {
  display: flex; align-items: center; height: 260px; margin: 0;
  font-size: 12px; line-height: 1.5; color: #8992a3;
}
.chart-info-note { margin: 8px 0 0; font-size: 11px; line-height: 1.4; color: #8992a3; }

.login-page {
  display: flex; align-items: center; justify-content: center; min-height: 100vh;
  padding: 24px;
}
.login-card {
  width: 100%; max-width: 360px; padding: 36px 32px 32px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.login-logo { height: 32px; margin-bottom: 20px; }
.login-title { font-size: 20px; font-weight: 700; color: var(--pt-deep); }
.login-subtitle { font-size: 13px; color: #8992a3; margin-top: 4px; margin-bottom: 24px; }
.login-error {
  width: 100%; background: rgba(229,62,62,.08); color: #c53030; border: 1px solid rgba(229,62,62,.2);
  border-radius: 8px; padding: 10px 12px; font-size: 12.5px; margin-bottom: 18px; text-align: left;
}
.login-form { width: 100%; display: flex; flex-direction: column; gap: 4px; text-align: left; }
.login-label { font-size: 12px; font-weight: 500; color: #4b5262; margin-top: 14px; }
.login-input {
  border: 1.5px solid rgba(55,63,138,.14); border-radius: 8px; padding: 10px 12px; font-size: 14px;
  font-family: 'Roboto', system-ui, sans-serif; color: var(--pt-graphite); width: 100%;
}
.login-input:focus { outline: none; border-color: var(--pt-institutional); }
.login-submit { justify-content: center; margin-top: 22px; width: 100%; padding: 10px 16px; font-size: 14px; }

.chart-plot.chart-plot-clickable { cursor: pointer; }
.modal-overlay {
  position: fixed; inset: 0; background: rgba(20,24,86,.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50; padding: 24px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--pt-white); border-radius: 12px; width: 100%; max-width: 760px;
  max-height: 80vh; display: flex; flex-direction: column;
  box-shadow: 0 12px 40px rgba(20,24,86,.25);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 16px 20px; border-bottom: 1px solid rgba(55,63,138,.08); flex-shrink: 0;
}
.modal-head h3 { font-size: 15px; font-weight: 900; color: var(--pt-deep); }
.modal-close {
  border: none; background: transparent; color: #8992a3; font-size: 20px; line-height: 1;
  cursor: pointer; padding: 4px 9px; border-radius: 6px; flex-shrink: 0;
}
.modal-close:hover { background: rgba(55,63,138,.06); color: var(--pt-deep); }
.modal-body { padding: 16px 20px 20px; overflow-y: auto; overflow-x: auto; }
.modal-empty { font-size: 13px; color: #8992a3; }
.modal-loading { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 28px 12px; font-size: 13px; color: #8992a3; }
.modal-loading p { margin: 0; }
.modal-loading-note { font-size: 11.5px; color: #9aa1b0; max-width: 380px; }
.modal-spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(55,63,138,.15); border-top-color: var(--pt-institutional);
  animation: refresh-spin .8s linear infinite;
}
.modal-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.modal-table th {
  text-align: left; font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: #8992a3; padding: 0 10px 8px; border-bottom: 1px solid rgba(55,63,138,.08);
  white-space: nowrap;
}
.modal-table td { padding: 8px 10px; border-bottom: 1px solid rgba(55,63,138,.06); color: #4b5262; }
.modal-table tr:last-child td { border-bottom: none; }
.modal-pair { display: flex; gap: 12px; flex-wrap: wrap; }
.modal-pair-item {
  flex: 1 1 160px; background: rgba(55,63,138,.04); border-radius: 10px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 6px;
}
.modal-pair-label { font-size: 11.5px; font-weight: 700; letter-spacing: .02em; color: #8992a3; }
.modal-pair-value { font-size: 20px; font-weight: 900; color: var(--pt-deep); }
