:root {
  color-scheme: light;
  --bg: #f3f4f6;
  --panel: #ffffff;
  --panel-strong: #f6f6f7;
  --ink: #151515;
  --muted: #666b73;
  --line: #d7d7da;
  --primary: #d71920;
  --primary-dark: #9f1117;
  --accent: #d71920;
  --black: #111111;
  --dark-gray: #2b2d31;
  --mid-gray: #8a8d93;
  --shadow: 0 14px 34px rgba(0, 0, 0, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1120px;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 300px minmax(820px, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: #111111;
  color: #fff;
  padding: 24px 20px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand-block {
  display: grid;
  gap: 10px;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.16);
}

.brand-logo {
  display: block;
  width: 210px;
  max-width: 100%;
  height: auto;
  object-fit: contain;
}

.brand-block h1 {
  margin: 0;
  font-size: 20px;
}

.brand-block p {
  margin: 4px 0 0;
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.filter-panel {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.filter-panel label {
  display: grid;
  gap: 7px;
}

.filter-panel span,
.multi-filter > span {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  text-transform: uppercase;
  font-weight: 700;
}

.multi-filter {
  display: grid;
  gap: 7px;
  position: relative;
}

.date-filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.date-filter-grid label {
  min-width: 0;
}

select:disabled,
input:disabled {
  opacity: 0.58;
  cursor: not-allowed;
  background: #e6e7ea;
}

.multi-trigger {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 34px 0 11px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  position: relative;
}

.multi-trigger::after {
  content: "▾";
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: #30343a;
  font-size: 13px;
}

.multi-panel {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  background: #171717;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.35);
  z-index: 20;
}

.multi-panel[hidden] {
  display: none;
}

.multi-options {
  max-height: 260px;
  overflow: auto;
  display: grid;
  gap: 6px;
  padding-right: 3px;
}

.multi-option {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: start;
  gap: 8px;
  padding: 8px;
  border: 1px solid #2c2c2c;
  border-radius: 6px;
  background: #111111;
  color: #f4f4f4;
  font-size: 12px;
  cursor: pointer;
}

.multi-option:hover {
  border-color: var(--primary);
  background: #1d1112;
}

.multi-option input {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--primary);
}

.multi-option-name {
  line-height: 1.25;
}

.multi-option-count {
  color: #b7b7b7;
  font-weight: 700;
  white-space: nowrap;
}

.multi-empty {
  padding: 12px;
  color: #c8c8c8;
  font-size: 13px;
  text-align: center;
}

.multi-clear {
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: #2a2a2a;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
}

.multi-clear:hover {
  background: #3a3a3a;
}

select,
input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
}

select:focus,
input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(215, 25, 32, 0.16);
}

.filter-panel button,
.table-tools button {
  height: 40px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
}

.filter-panel button:hover,
.table-tools button:hover {
  background: var(--primary-dark);
}

.dashboard {
  padding: 24px;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-weight: 800;
  text-transform: uppercase;
  font-size: 12px;
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.15;
}

.status-pill {
  padding: 8px 12px;
  background: #fff1f1;
  color: var(--primary-dark);
  border: 1px solid #f1b8bb;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
}

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

.kpi,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.kpi {
  padding: 16px;
}

.kpi span,
.kpi small {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.kpi strong {
  display: block;
  margin: 7px 0;
  font-size: 30px;
  line-height: 1;
  color: var(--primary);
}

.main-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, 0.85fr);
  gap: 14px;
  margin-bottom: 14px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.panel {
  min-width: 0;
  padding: 16px;
}

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.panel-header h3 {
  margin: 0;
  font-size: 17px;
}

.panel-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.bar-chart {
  display: grid;
  gap: 8px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(140px, 220px) 1fr 80px;
  align-items: center;
  gap: 10px;
  min-height: 28px;
}

.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #243449;
  font-size: 13px;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: #edf2f7;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #111111, var(--primary));
  min-width: 2px;
}

.bar-value {
  text-align: right;
  color: var(--muted);
  font-weight: 700;
  font-size: 13px;
}

.compact .bar-row {
  grid-template-columns: minmax(160px, 260px) 1fr 72px;
}

.donut-wrap {
  min-height: 250px;
}

.donut {
  width: 210px;
  height: 210px;
  border-radius: 50%;
  margin: 6px auto 12px;
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 42px;
  background: #fff;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px var(--line);
}

.legend {
  display: grid;
  gap: 7px;
}

.legend-row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
  color: var(--muted);
  padding: 4px 5px;
  border-radius: 6px;
  cursor: pointer;
}

.legend-row:hover,
.legend-row.active {
  background: #fff1f1;
  color: var(--black);
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.state-breakdown {
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.breakdown-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.breakdown-head h4 {
  margin: 0;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--black);
}

.breakdown-head button {
  border: 0;
  border-radius: 6px;
  background: #111111;
  color: #ffffff;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.state-bars {
  display: grid;
  gap: 8px;
  max-height: 255px;
  overflow: auto;
  padding-right: 4px;
}

.state-row {
  display: grid;
  grid-template-columns: 42px 1fr 88px;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.state-uf {
  font-weight: 900;
  color: var(--primary);
}

.state-meta {
  color: var(--muted);
  font-size: 11px;
  margin-top: 2px;
}

.state-value {
  text-align: right;
  font-weight: 900;
  color: var(--black);
}

.ranking-list {
  display: grid;
  gap: 8px;
  max-height: 290px;
  overflow: auto;
  padding-right: 4px;
}

.status-stack {
  display: grid;
  gap: 10px;
}

.status-row {
  display: grid;
  grid-template-columns: 110px 1fr 96px;
  align-items: center;
  gap: 10px;
}

.status-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #30343a;
  font-size: 13px;
  font-weight: 700;
}

.status-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(215, 25, 32, 0.12);
}

.status-track {
  height: 12px;
  border-radius: 999px;
  background: #edf0f3;
  overflow: hidden;
}

.status-fill {
  height: 100%;
  border-radius: 999px;
  min-width: 2px;
  background: linear-gradient(90deg, #111111, #d71920);
}

.status-value {
  color: var(--muted);
  font-size: 13px;
  text-align: right;
  font-weight: 800;
}

.priority-alta .status-dot,
.status-inativo .status-dot {
  background: #d71920;
}

.priority-media .status-dot,
.status-morno .status-dot {
  background: #6b6f76;
}

.priority-baixa .status-dot,
.status-ativo .status-dot {
  background: #111111;
}

.rank-item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px;
  background: var(--panel-strong);
  border: 1px solid #e8eef6;
  border-radius: 6px;
  cursor: pointer;
}

.rank-item:hover,
.client-item:hover,
.client-item.active {
  border-color: var(--accent);
  background: #fff1f1;
}

.rank-number {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 5px;
  background: #ffe1e3;
  color: var(--primary-dark);
  font-weight: 800;
  font-size: 12px;
}

.rank-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 700;
  font-size: 13px;
}

.rank-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 390px minmax(0, 1fr);
  gap: 14px;
}

.client-list {
  display: grid;
  gap: 8px;
  max-height: 680px;
  overflow: auto;
  padding-right: 4px;
}

.client-item {
  padding: 11px;
  border: 1px solid #e6edf5;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
}

.client-name {
  font-weight: 800;
  font-size: 13px;
  line-height: 1.25;
}

.client-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.detail-heading {
  align-items: center;
}

.detail-metrics {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.detail-metrics span {
  padding: 8px 10px;
  border-radius: 6px;
  background: #f3f4f6;
  color: var(--black);
  border: 1px solid var(--line);
  font-size: 13px;
}

.mix-panel {
  border: 1px solid var(--line);
  background: #fafafa;
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 12px;
}

.mix-panel h4 {
  margin: 0 0 9px;
  font-size: 13px;
  color: var(--black);
  text-transform: uppercase;
}

.mix-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.mix-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 9px;
  border-radius: 999px;
  background: #111111;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
}

.mix-chip strong {
  color: #ff3a44;
}

.table-tools {
  display: grid;
  grid-template-columns: 1fr 130px;
  gap: 10px;
  margin-bottom: 12px;
}

.table-wrap {
  max-height: 620px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #111111;
  color: #fff;
  text-align: left;
  padding: 10px 9px;
  white-space: nowrap;
}

tbody td {
  padding: 9px;
  border-top: 1px solid #e8eef6;
  vertical-align: top;
}

tbody tr:nth-child(even) {
  background: #f8fbfe;
}

tbody tr:hover {
  background: #fff4f4;
}

.map-section {
  margin-bottom: 14px;
}

.map-panel {
  padding-bottom: 12px;
}

.geo-map {
  width: 100%;
  height: 430px;
  border: 1px solid #252525;
  border-radius: 8px;
  overflow: hidden;
  background: #101113;
}

.map-legend {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.pulse-sample {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--primary);
  box-shadow: 0 0 0 5px rgba(215, 25, 32, 0.22);
}

.pulse-marker {
  display: block;
  position: relative;
  width: var(--size, 18px);
  height: var(--size, 18px);
}

.pulse-marker::before,
.pulse-marker::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(215, 25, 32, 0.42);
  animation: pulse 1.9s ease-out infinite;
}

.pulse-marker::after {
  inset: 18%;
  background: #ff1f2b;
  border: 2px solid rgba(255, 255, 255, 0.72);
  box-shadow: 0 0 16px rgba(255, 31, 43, 0.95), 0 0 5px rgba(255, 255, 255, 0.45);
  animation: none;
}

.leaflet-container {
  background: #101113;
  font-family: "Segoe UI", Arial, sans-serif;
}

.leaflet-control-zoom a {
  background: #151515 !important;
  color: #ffffff !important;
  border-color: #2f2f2f !important;
}

.leaflet-control-attribution {
  background: rgba(17, 17, 17, 0.75) !important;
  color: #bdbdbd !important;
}

.leaflet-control-attribution a {
  color: #ffffff !important;
}

.leaflet-popup-content-wrapper,
.leaflet-popup-tip {
  color: var(--ink);
  border-radius: 8px;
}

.map-popup-title {
  font-weight: 800;
  color: var(--black);
}

.map-popup-meta {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

@keyframes pulse {
  0% {
    transform: scale(0.45);
    opacity: 0.82;
  }
  80%,
  100% {
    transform: scale(1.9);
    opacity: 0;
  }
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1250px) {
  body {
    min-width: 980px;
  }

  .app-shell {
    grid-template-columns: 260px minmax(720px, 1fr);
  }

  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main-grid,
  .insight-grid,
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .client-list {
    max-height: 360px;
  }
}
