:root {
  --bg: #eceff3;
  --bg-gradient-a: #f7f8fb;
  --bg-gradient-b: #e9edf4;
  --surface: #ffffff;
  --surface-muted: #f5f7fb;
  --line: #d8deea;
  --text: #1a2538;
  --muted: #66738b;
  --primary: #1d3557;
  --primary-soft: #eef2fa;
  --accent: #e63946;
  --purple: #7c3aed;
  --teal: #14b8a6;
  --blue: #457b9d;
  --shadow: 0 2px 8px rgba(32, 52, 84, 0.05);
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  background: radial-gradient(circle at top right, var(--bg-gradient-b), var(--bg-gradient-a) 48%, var(--bg) 100%);
  color: var(--text);
  font-family: "Manrope", "Segoe UI", sans-serif;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 228px;
  height: 100vh;
  padding: 18px 14px;
  background: linear-gradient(180deg, #fdfdff, #f3f6fb);
  border-right: 1px solid var(--line);
  box-shadow: inset -1px 0 0 #ffffff, 6px 0 14px rgba(28, 46, 86, 0.04);
  display: flex;
  flex-direction: column;
  z-index: 8;
}

.sidebar-header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 16px;
  display: flex;
  justify-content: center;
}

.sidebar-header img {
  max-width: 140px;
  width: 100%;
  height: auto;
}

.sidebar-title {
  margin: 0 0 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tab-btn {
  border: 1px solid transparent;
  background: transparent;
  color: #33425f;
  font-weight: 700;
  font-size: 13px;
  text-align: left;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #7b89a5;
  opacity: 0.96;
  transition: color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.tab-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tab-btn:hover {
  background: #edf2fb;
  color: #223556;
}

.tab-btn:hover .tab-icon {
  color: #304772;
  transform: translateX(1px);
}

.tab-btn.active {
  background: linear-gradient(135deg, #274777, #1d3557);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 4px 10px rgba(24, 45, 79, 0.18);
}

.tab-btn.active .tab-icon {
  color: #dce9ff;
  opacity: 1;
}

.sidebar-footer {
  margin-top: auto;
  background: var(--primary-soft);
  border: 1px solid #d9e3f5;
  border-radius: 12px;
  padding: 10px;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.45;
}

.main-content {
  margin-left: 228px;
  width: calc(100vw - 228px);
  max-width: none;
  min-width: 0;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
}

.rate-card {
  background: #fff;
  border-color: var(--line);
  padding: 16px 18px;
}

.rate-card__head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #1f2937;
}

.rate-card__head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.rate-card__list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.rate-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(140px, 200px);
  gap: 12px;
  align-items: center;
  padding: 10px 8px;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.rate-row:hover {
  background: #f8fafc;
  border-color: rgba(148, 163, 184, 0.3);
}

.rate-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.rate-rank {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
  color: #475569;
  border-radius: 50%;
  background: #eef2ff;
  border: 1px solid rgba(148, 163, 184, 0.4);
}

.rate-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.rate-name {
  font-size: 14px;
  font-weight: 600;
  color: #1f2937;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rate-sub {
  font-size: 12px;
  color: #64748b;
}

.rate-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.rate-bar__track {
  position: relative;
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.rate-bar__fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.rate-value {
  min-width: 40px;
  text-align: right;
  font-size: 12px;
  font-weight: 700;
  color: #1f2937;
}

.rate-empty {
  font-size: 12px;
  color: #64748b;
  padding: 10px 0 4px;
}

.top-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
}

.top-header h1 {
  margin: 0;
  font-size: 24px;
}

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

.top-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 700;
}

.top-meta img {
  width: 92px;
  height: auto;
  opacity: 0.9;
}

.filters-card {
  padding: 12px 14px 10px;
}

.filters-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.filters-head h2 {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.ghost-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: #30436a;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 10px;
  cursor: pointer;
}

.ghost-btn:hover {
  background: #f1f5fd;
}

#clearFiltersBtn {
  margin-left: auto;
}

.filters-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(130px, 1fr));
  gap: 10px;
}

.filters-grid label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filters-grid span {
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.filters-grid select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  height: 36px;
  padding: 0 10px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
}

.error-banner {
  background: #fff0f1;
  color: #8f1d30;
  border: 1px solid #f2bac2;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
}

.tab-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, minmax(120px, 1fr));
  gap: 10px;
}

.kpi-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px 12px;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.22s ease, box-shadow 0.26s ease, border-color 0.22s ease, background 0.26s ease;
}

.kpi-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0), rgba(149, 170, 210, 0.08));
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: #c5d1e7;
  box-shadow: 0 8px 18px rgba(26, 45, 79, 0.14);
}

.kpi-card:hover::after {
  opacity: 1;
}

.kpi-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid #ccd5e8;
  background: linear-gradient(180deg, #f8faff, #edf2fb);
  color: #50668d;
  opacity: 0.95;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease, color 0.22s ease;
}

.kpi-icon svg {
  width: 11px;
  height: 11px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.kpi-card:hover .kpi-icon {
  transform: scale(1.05);
  border-color: #b8c6e0;
  background: linear-gradient(180deg, #f0f5ff, #e7eefc);
  color: #38507f;
}

.kpi-card h3 {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  min-height: 28px;
}

.kpi-card p {
  margin: 6px 0 0;
  font-size: 33px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
}

.kpi-card.highlight {
  background: linear-gradient(155deg, #f5f7ff, #eff2fc);
  border-color: #d3dcf0;
}

.kpi-card.highlight .kpi-icon {
  border-color: #d6c4ff;
  background: linear-gradient(180deg, #f9f4ff, #f2e8ff);
  color: #7c3aed;
}

.kpi-card.highlight:hover {
  border-color: #c7b2f6;
  box-shadow: 0 10px 20px rgba(124, 58, 237, 0.2);
}

.kpi-card.highlight:hover .kpi-icon {
  border-color: #c8aef7;
  background: linear-gradient(180deg, #f5eaff, #ecdfff);
  color: #6d28d9;
}

.metric-card {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 150px;
}

.metric-card--center {
  text-align: center;
  align-items: center;
}

.metric-card--hero {
  min-height: 170px;
}

.metric-card__eyebrow {
  font-size: 0.72rem;
  color: #94a3b8;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.metric-card__value {
  font-size: 2.6rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
}

.metric-card__value--xl {
  font-size: 3.2rem;
}

.metric-card__sub {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: #64748b;
  font-weight: 500;
}

.metric-card__meta {
  margin-top: 4px;
  font-size: 0.85rem;
  font-weight: 600;
}

.metric-card__footer {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.85rem;
  color: #64748b;
}

.metric-card__footer--center {
  justify-content: center;
}

.metric-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #e2e8f0;
  color: #475569;
}

.metric-delta {
  font-size: 0.85rem;
  font-weight: 600;
  color: #64748b;
}

.grid {
  display: grid;
  gap: 14px;
}

.two-col-8-4 {
  grid-template-columns: 2fr 1fr;
}

.two-col {
  grid-template-columns: 1fr 1fr;
}

.card h2 {
  margin: 0 0 10px;
  font-size: 15px;
}

.title-with-ai {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.title-with-ai h2 {
  margin: 0;
}

.ai-insight-btn {
  position: relative;
  border: 1px solid #d6deee;
  background: #f7f9fe;
  color: #607394;
  border-radius: 8px;
  width: 30px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(56, 84, 132, 0.08);
}

.ai-insight-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.ai-insight-btn::after {
  content: "";
  position: absolute;
  top: -3px;
  right: -3px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  opacity: 0;
  transform: scale(0.5);
  transition: all 0.2s ease;
}

.ai-insight-btn:hover {
  transform: translateY(-1px);
}

.ai-insight-btn.has-insight::after {
  opacity: 1;
  transform: scale(1);
  animation: insight-dot-pulse 1.5s ease-in-out infinite;
}

.ai-insight-btn.sentiment-positive {
  border-color: #bfe8d9;
  background: #ecfaf4;
  color: #176b56;
  box-shadow: 0 3px 9px rgba(19, 129, 98, 0.15);
}

.ai-insight-btn.sentiment-positive::before {
  background: radial-gradient(circle at center, rgba(19, 129, 98, 0.22), rgba(19, 129, 98, 0));
}

.ai-insight-btn.sentiment-positive::after {
  background: #18b57d;
}

.ai-insight-btn.sentiment-neutral {
  border-color: #d8cdf6;
  background: #f6f1ff;
  color: #7c3aed;
  box-shadow: 0 3px 9px rgba(124, 58, 237, 0.15);
}

.ai-insight-btn.sentiment-neutral::before {
  background: radial-gradient(circle at center, rgba(124, 58, 237, 0.23), rgba(124, 58, 237, 0));
}

.ai-insight-btn.sentiment-neutral::after {
  background: #a855f7;
}

.ai-insight-btn.sentiment-negative {
  border-color: #f6b5bf;
  background: #fff2f4;
  color: #e11d48;
  box-shadow: 0 3px 10px rgba(225, 29, 72, 0.17);
}

.ai-insight-btn.sentiment-negative::before {
  background: radial-gradient(circle at center, rgba(225, 29, 72, 0.23), rgba(225, 29, 72, 0));
}

.ai-insight-btn.sentiment-negative::after {
  background: #f43f5e;
}

.ai-insight-btn.active {
  transform: translateY(-1px);
}

.ai-insight-btn.active::before {
  opacity: 1;
  animation: insight-glow 1.9s ease-in-out infinite;
}

.ai-insight-btn.active svg {
  transform: rotate(-10deg) scale(1.04);
}

.ai-insight-btn.no-insight {
  opacity: 0.85;
  border-color: #d9deea;
  background: #f6f8fc;
  color: #74839d;
  box-shadow: 0 2px 6px rgba(78, 96, 130, 0.08);
}

.ai-insight-btn.no-insight::after {
  opacity: 0.6;
  transform: scale(1);
  animation: none;
}

.ai-insight-btn:hover {
  transform: translateY(-1px);
}

.ai-insight-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  transition: transform 0.2s ease;
}

.ai-insight-panel {
  position: fixed;
  z-index: 1200;
  width: min(360px, calc(100vw - 20px));
  background: #ffffff;
  border: 1px solid #e2e7f1;
  border-radius: 12px;
  box-shadow: 0 18px 34px rgba(16, 37, 72, 0.14);
  padding: 0;
  overflow: hidden;
}

.ai-insight-panel.sentiment-positive {
  border-color: #bfe8d9;
  box-shadow: 0 18px 34px rgba(19, 129, 98, 0.19);
}

.ai-insight-panel.sentiment-neutral {
  border-color: #d8cdf6;
  box-shadow: 0 18px 34px rgba(124, 58, 237, 0.18);
}

.ai-insight-panel.sentiment-negative {
  border-color: #f6b5bf;
  box-shadow: 0 18px 34px rgba(225, 29, 72, 0.2);
}

.ai-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  padding: 12px;
  border-bottom: 1px solid #ecf0f7;
}

.ai-panel-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-panel-title-icon {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ai-panel-title-icon svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.ai-panel-title-icon.sentiment-positive {
  color: #176b56;
  background: #ecfaf4;
}

.ai-panel-title-icon.sentiment-neutral {
  color: #7c3aed;
  background: #f6f1ff;
}

.ai-panel-title-icon.sentiment-negative {
  color: #e11d48;
  background: #fff2f4;
}

.ai-panel-title {
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

.ai-panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ai-panel-close {
  border: 0;
  background: transparent;
  color: #93a1bb;
  font-size: 16px;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}

.ai-panel-close:hover {
  color: #4b5f84;
}

.ai-badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 999px;
  font-weight: 800;
  text-transform: uppercase;
}

.ai-badge.neutral {
  background: #f1f5fe;
  color: #38517b;
}

.ai-badge.positive {
  background: #e8fbf2;
  color: #0f766e;
}

.ai-badge.negative {
  background: #fff0f2;
  color: #be123c;
}

.ai-panel-list {
  margin: 0;
  padding: 10px 12px 12px 28px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.ai-panel-list li {
  font-size: 12px;
  color: #33425f;
  line-height: 1.4;
}

.ai-panel-body {
  padding: 10px 12px 12px;
  background: linear-gradient(180deg, #fbfcff, #f7f9fe);
}

.ai-panel-items {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ai-panel-item {
  display: grid;
  grid-template-columns: 20px 1fr;
  align-items: start;
  gap: 8px;
  border-radius: 9px;
  border: 1px solid #edf1f8;
  background: #ffffff;
  padding: 8px 9px;
}

.ai-item-icon {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  line-height: 1;
  margin-top: 1px;
}

.ai-panel-item.kind-lead .ai-item-icon {
  background: #fff5e7;
  color: #c46a00;
}

.ai-panel-item.kind-concentration .ai-item-icon,
.ai-panel-item.kind-trend .ai-item-icon {
  background: #eef3ff;
  color: #34538a;
}

.ai-panel-item.kind-alert .ai-item-icon {
  background: #fff1f2;
  color: #be123c;
}

.ai-panel-item.kind-tail .ai-item-icon,
.ai-panel-item.kind-neutral .ai-item-icon {
  background: #f2f5fb;
  color: #5a6f93;
}

.ai-item-text {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: #2b3d5f;
}

.ai-item-text strong {
  color: #102847;
  font-weight: 800;
}

.ai-panel-foot {
  border-top: 1px solid #ecf0f7;
  padding: 8px 12px;
  text-align: center;
  font-size: 10px;
  color: #6f7f9b;
  background: #f9fbff;
}

@keyframes insight-dot-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(168, 85, 247, 0.3);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(168, 85, 247, 0);
  }
}

@keyframes insight-glow {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 0.9;
  }
}

.chart-card canvas {
  width: 100% !important;
  height: 300px !important;
  max-height: 300px !important;
}

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

.mini-title {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
  font-weight: 700;
}

.period-switch {
  display: flex;
  gap: 6px;
}

.period-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 8px;
  font-size: 10px;
  font-weight: 700;
  padding: 5px 8px;
  cursor: pointer;
}

.period-btn.active {
  border-color: #9db5e1;
  color: var(--primary);
  background: #edf3ff;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.projection-toggle {
  border: 1px solid #d8cdf6;
  background: #fff;
  color: #5b21b6;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.projection-toggle:focus-visible {
  outline: 2px solid rgba(124, 58, 237, 0.35);
  outline-offset: 2px;
}

.projection-toggle__track {
  width: 34px;
  height: 18px;
  background: #e2e8f0;
  border-radius: 999px;
  position: relative;
  flex-shrink: 0;
  transition: background 0.2s ease;
}

.projection-toggle__thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  top: 2px;
  left: 2px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.2);
  transition: transform 0.2s ease;
}

.projection-toggle.active {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.projection-toggle.active .projection-toggle__track {
  background: #16a34a;
}

.projection-toggle.active .projection-toggle__thumb {
  transform: translateX(16px);
}

.projection-toggle--compact {
  font-size: 10px;
  padding: 3px 8px;
  gap: 8px;
}

.projection-toggle--compact .projection-toggle__track {
  width: 30px;
  height: 16px;
}

.projection-toggle--compact .projection-toggle__thumb {
  width: 12px;
  height: 12px;
}

.projection-toggle--compact.active .projection-toggle__thumb {
  transform: translateX(14px);
}

.projection-toggle--filter {
  font-size: 12px;
  padding: 6px 12px;
  margin-left: 12px;
}

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

.rank-list,
.question-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.rank-row {
  display: grid;
  grid-template-columns: 180px 1fr 70px;
  align-items: center;
  gap: 8px;
}

.rank-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  position: relative;
  min-width: 0;
  overflow: visible;
}

.rank-name::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #95a4c3;
  flex: 0 0 5px;
}

.rank-bar-track {
  height: 20px;
  background: #eff3fa;
  border-radius: 999px;
  overflow: hidden;
}

.rank-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #7c3aed, #5b21b6);
}

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

.question-row {
  display: grid;
  grid-template-columns: 220px 1fr 55px;
  align-items: center;
  gap: 8px;
}

.question-name {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  position: relative;
  min-width: 0;
  overflow: visible;
}

.question-name::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 999px;
  background: #95a4c3;
  flex: 0 0 5px;
}

.text-ellipsis {
  display: block;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tooltip-trigger[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 10px;
  top: calc(100% + 7px);
  max-width: min(560px, 62vw);
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid #c9d6ec;
  background: linear-gradient(180deg, #fdfefe, #f3f8ff);
  color: #203354;
  font-size: 12px;
  line-height: 1.35;
  font-weight: 700;
  white-space: normal;
  box-shadow: 0 8px 20px rgba(34, 54, 86, 0.16);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-3px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
  z-index: 40;
}

.tooltip-trigger:hover::after,
.tooltip-trigger:focus-visible::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.question-bar-track {
  height: 20px;
  background: #eff3fa;
  border-radius: 999px;
  overflow: hidden;
  position: relative;
}

.question-bar-scale {
  height: 100%;
  display: flex;
}

.question-part-def {
  background: var(--purple);
}

.question-part-indef {
  background: var(--teal);
}

.question-part-open {
  background: var(--blue);
}

.question-total {
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  font-weight: 700;
}

.table-card {
  padding: 0;
}

.table-card h2 {
  padding: 16px;
  border-bottom: 1px solid var(--line);
  margin: 0;
}

.table-wrapper {
  overflow: auto;
  max-height: 620px;
  width: 100%;
}

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

thead th {
  position: sticky;
  top: 0;
  background: #f4f7fd;
  color: #475471;
  z-index: 2;
}

th,
td {
  border-bottom: 1px solid #ecf1fa;
  padding: 8px;
  text-align: left;
  vertical-align: top;
}

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

tbody tr:hover {
  background: #eef4ff;
}

.status-pill {
  display: inline-flex;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 800;
  border: 1px solid transparent;
}

.status-pill.status-deferido {
  background: #f0e8ff;
  color: #6d28d9;
  border-color: #dec9ff;
}

.status-pill.status-indeferido {
  background: #ddfbf6;
  color: #0f766e;
  border-color: #acefe5;
}

.status-pill.status-default {
  background: #e6f1ff;
  color: #0f4c81;
  border-color: #cae1ff;
}

.table-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
  background: #f7f9fd;
}

.table-pagination button {
  border: 1px solid var(--line);
  background: #fff;
  color: #30436a;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  cursor: pointer;
}

.table-pagination button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.alerts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}

.alert-card {
  border: 1px solid #f4c4cb;
  background: linear-gradient(160deg, #fff2f4, #ffffff);
  border-radius: 12px;
  padding: 10px;
}

.alert-card h3 {
  margin: 0 0 6px;
  font-size: 12px;
}

.alert-card p {
  margin: 4px 0;
  font-size: 11px;
  color: #7c3044;
}

.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  margin-top: 6px;
  height: 28px;
}

.sparkline span {
  flex: 1;
  background: linear-gradient(180deg, #ef4444, #fca5a5);
  border-radius: 999px;
  min-height: 3px;
}

.empty-state {
  font-size: 12px;
  color: var(--muted);
  background: #f6f9fe;
  border: 1px dashed #cad8f0;
  border-radius: 10px;
  padding: 10px;
}

.loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 999;
  background:
    radial-gradient(circle at 20% 20%, rgba(124, 58, 237, 0.12), transparent 52%),
    radial-gradient(circle at 80% 80%, rgba(20, 184, 166, 0.1), transparent 55%),
    rgba(236, 241, 249, 0.84);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
  backdrop-filter: blur(6px);
}

.loader-shell {
  min-width: 230px;
  padding: 18px 20px 16px;
  border-radius: 18px;
  background: transparent;
  border: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.loader-stage {
  width: 170px;
  height: 72px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loader-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.face-logo {
  animation: loader-face-a 2.6s linear infinite;
}

.face-logo img {
  width: 138px;
  height: auto;
  object-fit: contain;
}

.face-text {
  font-size: 28px;
  letter-spacing: -0.02em;
  font-weight: 800;
  color: #24467a;
  animation: loader-face-b 2.6s linear infinite;
}

.loader-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.loader-dots span {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: #6b7ea3;
  opacity: 0.45;
  animation: loader-dot 0.9s ease-in-out infinite;
}

.loader-dots span:nth-child(2) {
  animation-delay: 0.14s;
}

.loader-dots span:nth-child(3) {
  animation-delay: 0.28s;
}

.loader-caption {
  margin: 0;
  font-size: 12px;
  color: #566b93;
  font-weight: 700;
  letter-spacing: 0.02em;
}

@keyframes loader-face-a {
  0%,
  34% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  46%,
  86% {
    opacity: 0;
    transform: scale(0.9) translateY(-1px);
  }
  100% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes loader-face-b {
  0%,
  34% {
    opacity: 0;
    transform: scale(0.9) translateY(1px);
  }
  46%,
  86% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
  100% {
    opacity: 0;
    transform: scale(0.9) translateY(1px);
  }
}

@keyframes loader-dot {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.4;
  }
  50% {
    transform: translateY(-4px);
    opacity: 0.95;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.card.chart-card {
  position: relative;
  overflow: visible;
}

#chartStatus,
#chartStatusExceptions {
  height: 220px !important;
  max-height: 220px !important;
}

#chartPareto {
  height: 340px !important;
  max-height: 340px !important;
}

#chartScatter,
#chartTemporal {
  height: 280px !important;
  max-height: 280px !important;
}

.mydash-summary {
  margin: 0;
  font-size: 12px;
  color: #526686;
  font-weight: 700;
}

.motivo-summary {
  margin: 0;
  padding-left: 18px;
  color: #475569;
  font-size: 0.9rem;
  line-height: 1.6;
}

.motivo-summary li {
  margin-bottom: 6px;
}

.motivo-summary li:last-child {
  margin-bottom: 0;
}

.motivo-trend-tooltip {
  position: absolute;
  z-index: 6;
  width: 320px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 12px;
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  transition: opacity 0.16s ease, transform 0.16s ease;
  pointer-events: none;
}

.motivo-trend-tooltip.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.motivo-trend-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 8px;
}

.motivo-trend-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: #0f172a;
  line-height: 1.2;
}

.motivo-trend-total {
  font-size: 0.75rem;
  font-weight: 600;
  color: #475569;
  white-space: nowrap;
}

.motivo-trend-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.motivo-trend-row {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 8px;
  align-items: center;
}

.motivo-trend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 2px;
}

.motivo-trend-name {
  font-size: 0.75rem;
  color: #334155;
  line-height: 1.2;
  word-break: break-word;
}

.motivo-trend-values {
  text-align: right;
  font-size: 0.7rem;
  color: #64748b;
}

.motivo-trend-main {
  font-weight: 700;
  color: #0f172a;
}

.motivo-trend-sub {
  display: block;
  font-size: 0.65rem;
  color: #94a3b8;
}

.motivo-trend-bar {
  grid-column: 2 / 4;
  height: 6px;
  border-radius: 999px;
  background: #f1f5f9;
  overflow: hidden;
}

.motivo-trend-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #7c3aed, #22d3ee);
  border-radius: 999px;
}

.motivo-trend-empty {
  font-size: 0.75rem;
  color: #94a3b8;
}

.motivo-controls {
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
  margin: 4px 0 16px;
  color: #334155;
  font-size: 0.85rem;
}

.motivo-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
}

.motivo-toggle input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: #7c3aed;
}

.mydash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
  gap: 14px;
}

.mydash-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mydash-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}

.mydash-card-head h3 {
  margin: 0;
  font-size: 14px;
  color: #1d3557;
}

.mydash-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mydash-status {
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  border: 1px solid transparent;
}

.mydash-status.is-ok {
  background: #e9fbf2;
  color: #116b4e;
  border-color: #bee9d5;
}

.mydash-status.is-skipped {
  background: #f4f7fc;
  color: #506488;
  border-color: #d8e0ee;
}

.mydash-status.is-error {
  background: #fff1f3;
  color: #b82043;
  border-color: #f5c0cb;
}

.mydash-meta {
  margin: 0;
  font-size: 11px;
  color: #576b8f;
  font-weight: 700;
}

.mydash-pin-meta {
  margin: -4px 0 0;
  font-size: 11px;
  color: #4d6388;
}

.mydash-note {
  margin: 0;
  font-size: 12px;
  color: #5c6f91;
}

.mydash-pin-btn {
  border: 1px solid #c8d5ea;
  background: #f2f7ff;
  color: #27406b;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  font-size: 14px;
  font-weight: 800;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mydash-pin-btn span {
  line-height: 1;
}

.mydash-pin-btn:hover {
  background: #e8f0ff;
}

.mydash-pin-btn.is-pinned {
  border-color: #9cb3df;
  background: #d7e5ff;
  color: #17386d;
}

.mydash-chart-btn {
  border: 1px solid #d4deef;
  background: #f7faff;
  color: #2f466f;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  padding: 5px 8px;
  cursor: pointer;
}

.mydash-chart-btn:hover {
  background: #edf3fd;
}

.mydash-export-btn {
  border: 1px solid #d4deef;
  background: #f7faff;
  color: #2f466f;
  border-radius: 8px;
  width: 30px;
  height: 30px;
  font-size: 14px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mydash-export-btn:hover {
  background: #edf3fd;
}

.mydash-chart-wrap {
  height: 240px;
}

.mydash-canvas {
  width: 100% !important;
  height: 100% !important;
}

.mydash-table-wrap {
  max-height: 260px;
  overflow: auto;
  border: 1px solid #dbe3f0;
  border-radius: 10px;
}

.mydash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
  background: #ffffff;
}

.mydash-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #eef3fb;
  color: #425473;
}

.mydash-table th,
.mydash-table td {
  border-bottom: 1px solid #e8edf6;
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}

.floating-chat {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1300;
}

.chat-fab {
  width: 56px;
  height: 56px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(140deg, #24457a, #1d3557);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(20, 39, 71, 0.3);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.chat-fab svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-fab:hover {
  transform: translateY(-2px);
  box-shadow: 0 15px 26px rgba(20, 39, 71, 0.34);
}

.chat-panel {
  position: absolute;
  right: 0;
  bottom: 68px;
  width: min(360px, calc(100vw - 28px));
  height: min(540px, 72vh);
  background: #ffffff;
  border: 1px solid #d8deea;
  border-radius: 16px;
  box-shadow: 0 24px 42px rgba(23, 41, 74, 0.2);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transform-origin: bottom right;
  transform: translateY(10px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.floating-chat.open .chat-panel {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.floating-chat.open .chat-fab {
  background: linear-gradient(140deg, #1d3557, #152a48);
}

.chat-header {
  padding: 12px 14px;
  border-bottom: 1px solid #e6ecf7;
  background: linear-gradient(180deg, #f9fbff, #f1f5fc);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-header h3 {
  margin: 0;
  color: #1d3557;
  font-size: 13px;
}

.chat-header p {
  margin: 4px 0 0;
  color: #5d6f8e;
  font-size: 11px;
  font-weight: 700;
}

.chat-close {
  border: 0;
  background: transparent;
  color: #7b8ba8;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.chat-close:hover {
  background: #e7eef9;
  color: #304772;
}

.chat-messages {
  flex: 1;
  padding: 12px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: radial-gradient(circle at top right, #f3f7ff, #f9fbff 50%, #f4f7fd);
}

.chat-message {
  max-width: 90%;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 12px;
  line-height: 1.45;
  box-shadow: 0 2px 7px rgba(46, 67, 105, 0.08);
}

.chat-message-user {
  margin-left: auto;
  background: #1d3557;
  color: #ffffff;
  border-bottom-right-radius: 4px;
}

.chat-message-bot {
  margin-right: auto;
  background: #ffffff;
  color: #2f456b;
  border: 1px solid #d9e1ef;
  border-bottom-left-radius: 4px;
}

.chat-input-area {
  padding: 10px;
  border-top: 1px solid #e6ecf7;
  background: #ffffff;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.chat-input {
  border: 1px solid #d0daeb;
  border-radius: 10px;
  height: 40px;
  padding: 0 10px;
  font-size: 13px;
  color: #1a2538;
  background: #ffffff;
}

.chat-input:focus {
  outline: none;
  border-color: #8fa8d4;
  box-shadow: 0 0 0 3px rgba(90, 122, 176, 0.15);
}

.chat-send {
  border: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #1d3557;
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.chat-send svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-send:hover:not(:disabled) {
  background: #152a48;
  transform: translateY(-1px);
}

.chat-send:disabled,
.chat-input:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.chat-typing {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  width: fit-content;
  padding: 9px 10px;
  border-radius: 12px;
  border: 1px solid #d9e1ef;
  background: #ffffff;
  margin-right: auto;
}

.chat-typing span {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #95a4c3;
  animation: chat-typing 1s ease-in-out infinite;
}

.chat-typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.chat-typing span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes chat-typing {
  0%,
  100% {
    transform: translateY(0);
    opacity: 0.45;
  }
  50% {
    transform: translateY(-3px);
    opacity: 1;
  }
}

@media (max-width: 1280px) {
  .kpi-grid {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
  }

  .kpi-card p {
    font-size: 27px;
  }

  .filters-grid {
    grid-template-columns: repeat(3, minmax(130px, 1fr));
  }

  .main-content {
    max-width: none;
  }

  .status-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .sidebar {
    position: static;
    width: 100%;
    height: auto;
  }

  .sidebar-nav {
    flex-direction: row;
    overflow: auto;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
    max-width: none;
    padding: 12px;
  }

  .top-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .filters-grid {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

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

  .kpi-card p {
    font-size: 24px;
  }

  .two-col,
  .two-col-8-4 {
    grid-template-columns: 1fr;
  }

  .rank-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .question-row {
    grid-template-columns: 1fr;
    gap: 5px;
  }

  .question-name,
  .rank-name {
    white-space: normal;
  }

  .mydash-grid {
    grid-template-columns: 1fr;
  }

  .floating-chat {
    right: 12px;
    bottom: 12px;
  }

  .chat-panel {
    width: min(360px, calc(100vw - 16px));
    height: min(68vh, 500px);
  }
}
