/* =========================================================
   GRID & CARDS
   ========================================================= */

.mg-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 1024px) {
  .mg-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 600px) {
  .mg-grid {
    grid-template-columns: 1fr;
  }
}

.mg-card {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  transition: box-shadow 0.2s ease;
}

.mg-card:hover {
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.06);
}

/* =========================================================
   ICON
   ========================================================= */

.mg-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #2563eb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mg-icon svg {
  width: 20px;
  height: 20px;
  fill: #ffffff;
}

/* =========================================================
   CARD CONTENT
   ========================================================= */

.mg-number {
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
}

.mg-label {
  margin-top: 2px;
  font-size: 14px;
  color: #6b7280;
}

.mg-trend {
  margin-top: 6px;
  font-size: 13px;
  font-weight: 600;
}

.mg-trend.up {
  color: #16a34a;
}

.mg-trend.down {
  color: #dc2626;
}

/* =========================================================
   CHART
   ========================================================= */

.mg-chart {
  margin-top: 26px;
}

/* =========================================================
   FILTER BAR (GA STYLE)
   ========================================================= */

.mg-filter {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

/* push filter controls to right */
.mg-range-btn {
  margin-left: auto;
}

/* label + caret */
.mg-range-text {
  cursor: pointer;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.mg-caret {
  transition: transform 0.2s ease;
}

.mg-range-text.open .mg-caret {
  transform: rotate(180deg);
}

/* =========================================================
   DROPDOWN
   ========================================================= */

.mg-range-dropdown {
  display: none;
  position: absolute;
  top: 44px;
  right: 0;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
  min-width: 520px;
  z-index: 100;
  overflow: hidden;
}

.mg-range-dropdown.open {
  display: flex;
}

/* =========================================================
   DROPDOWN LEFT (PRESETS)
   ========================================================= */

.mg-range-left {
  width: 220px;
  background: #fafafa;
  border-right: 1px solid #e5e7eb;
}

.mg-range-left div {
  padding: 10px 14px;
  font-size: 14px;
  cursor: pointer;
}

.mg-range-left div:hover,
.mg-range-left .active {
  background: #eef2ff;
}

/* =========================================================
   DROPDOWN RIGHT (DATES)
   ========================================================= */

.mg-range-right {
  width: 300px;
  padding: 16px;
}

.mg-range-right label {
  display: block;
  font-size: 12px;
  color: #6b7280;
  margin-bottom: 4px;
}

.mg-range-right input[type="date"] {
  width: 100%;
  padding: 8px 10px;
  font-size: 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  margin-bottom: 12px;
}

/* =========================================================
   ACTION BUTTONS
   ========================================================= */

.mg-range-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 12px;
}

.mg-range-actions button {
  padding: 6px 14px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  cursor: pointer;
}

.mg-range-actions button:last-child {
  background: #2563eb;
  color: #ffffff;
  border-color: #2563eb;
}
