body {
  background: #f4f6fa;
  font-family: "Inter", sans-serif;
  padding: 24px 0;
}

h1,
h2,
p {
  margin: 0;
}

.container-fluid {
  padding-left: 32px;
  padding-right: 32px;
  max-width: 1400px;
}

.dashboard-page {
  display: grid;
  gap: 1rem;
}

.dashboard-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #222b45;
}

.dashboard-header {
  display: grid;
  gap: 0.35rem;
}

.dashboard-subtitle {
  font-size: 0.9rem;
  color: #7b8a9e;
  line-height: 1.5;
}

.card-stat {
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.06);
  border: none;
  border-radius: 0.7rem;
  padding: 0.75rem 0.8rem;
  background: #fff;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 0;
  min-height: 90px;
}

.card-stat .icon {
  font-size: 1.6rem;
  color: #fff;
  background: linear-gradient(135deg, #ffb347 60%, #ffcc80 100%);
  border-radius: 0.5rem;
  width: 2.7rem;
  height: 2.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.card-stat .stat-label {
  font-size: 0.92rem;
  color: #7b8a9e;
  font-weight: 500;
}

.card-stat .stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: #222b45;
  min-height: 2.15rem;
  display: flex;
  align-items: center;
  line-height: 1.1;
}

.card-stat .stat-value.stat-value-positive {
  color: #15803d;
}

.card-stat .stat-value.stat-value-negative {
  color: #b91c1c;
}

.card-shadow {
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.06);
  border-radius: 0.7rem;
  background: #fff;
  padding: 1rem;
}

.agent-select-form {
  width: 100%;
  margin: 0;
}

.agent-select-controls {
  position: relative;
  width: 100%;
}

.agent-select {
  min-width: 0;
  width: 100%;
  height: 2.15rem;
  padding: 0.375rem 2rem 0.375rem 0.75rem;
  border-radius: 0.5rem;
  border: 1.5px solid #e2e8f0;
  background-color: #f8fafc;
  background-image: none;
  color: #1e293b;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.4;
  box-shadow: none;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
}

.agent-select:hover {
  border-color: #cbd5e1;
  background-color: #f1f5f9;
}

.agent-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
  background-color: #f8fafc;
}

.agent-select:active {
  border-color: #2563eb;
  box-shadow: none;
}

.agent-select-controls::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 0.5rem;
  width: 4px;
  height: 4px;
  border-right: 1.5px solid #64748b;
  border-bottom: 1.5px solid #64748b;
  transform: translateY(-65%) rotate(45deg);
  pointer-events: none;
  transition: transform 0.2s ease;
}

.stat-content {
  display: grid;
  grid-template-rows: auto minmax(2.15rem, auto);
  align-content: center;
  gap: 0.2rem;
  flex: 1;
  min-width: 0;
}

.agent-pill-group {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.agent-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: #eef2ff;
  color: #3730a3;
  font-weight: 600;
}

.g-3,
.gy-3 {
  --bs-gutter-y: 1rem;
}

.g-3,
.gx-3 {
  --bs-gutter-x: 1rem;
}

.plot-container {
  height: 28vw;
  min-height: 180px;
  max-height: 340px;
  width: 100%;
  position: relative;
  overflow: hidden;
}

.plot-container .plotly-graph-div {
  height: 100% !important;
  width: 100% !important;
  min-width: 0 !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
}

.dashboard-footer {
  margin-top: 0.25rem;
}

.popup-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.popup-container {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: white;
  padding: 1.5rem;
  border-radius: 0.7rem;
  box-shadow: 0 4px 12px rgba(44, 62, 80, 0.15);
  z-index: 1001;
  width: min(42rem, calc(100% - 2rem));
}

.popup-title {
  font-size: 1.2rem;
  font-weight: 600;
  color: #222b45;
  margin-bottom: 1rem;
}

.popup-content {
  color: #4a5568;
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.popup-button {
  background: linear-gradient(135deg, #1e3a5c 60%, #3a7bd5 100%);
  color: white;
  border: none;
  padding: 0.5rem 1.5rem;
  border-radius: 0.5rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.3s;
}

.popup-button:hover {
  background: linear-gradient(135deg, #2a4d78 60%, #4b8ce6 100%);
}

@media (max-width: 991px) {
  .container-fluid {
    padding-left: 10px;
    padding-right: 10px;
  }

  .dashboard-title {
    font-size: 1.1rem;
  }

  .card-stat .stat-value {
    font-size: 1rem;
  }

  .card-shadow {
    padding: 0.7rem;
  }

  .plot-container {
    height: 38vw;
    min-height: 140px;
    max-height: 260px;
    aspect-ratio: 16/9;
  }
}

@media (max-width: 767px) {
  .dashboard-title {
    font-size: 1rem;
  }

  .card-stat .stat-value {
    font-size: 0.9rem;
  }

  .card-shadow {
    padding: 0.5rem;
  }

  .plot-container {
    height: 48vw;
    min-height: 120px;
    max-height: 200px;
    aspect-ratio: 4/3;
  }

  .popup-container {
    padding: 1.25rem;
  }
}
