#apo-agg-btn {
  display: inline-block;
  margin-left: 6px;
  padding: 4px 10px;
  background: #4a90e2;
  color: #fff !important;
  border-radius: 4px;
  text-decoration: none !important;
  font-size: 12px;
  cursor: pointer;
  vertical-align: middle;
}
#apo-agg-btn:hover { background: #357ab8; }

#apo-agg-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  z-index: 999999; display: flex; align-items: center; justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
#apo-agg-modal {
  background: #fff; width: 90vw; max-width: 1100px; max-height: 90vh;
  border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,.3);
  display: flex; flex-direction: column; overflow: hidden;
}
#apo-agg-header {
  padding: 12px 16px; border-bottom: 1px solid #ddd;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: #f7f9fc;
}
#apo-agg-header h2 { margin: 0; font-size: 16px; flex: 1; }
#apo-agg-body {
  flex: 1; overflow: auto; padding: 16px;
}
.apo-agg-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.apo-agg-btn {
  background: #4a90e2; color: #fff; border: none; padding: 6px 12px;
  border-radius: 4px; cursor: pointer; font-size: 13px;
}
.apo-agg-btn:hover { background: #357ab8; }
.apo-agg-btn.secondary { background: #888; }
.apo-agg-btn.secondary:hover { background: #666; }
.apo-agg-btn.danger { background: #d9534f; }
.apo-agg-btn.danger:hover { background: #b52b27; }
.apo-agg-btn:disabled { background: #ccc !important; cursor: not-allowed; }
.apo-agg-close {
  background: transparent; border: none; font-size: 22px; cursor: pointer;
  color: #555; padding: 0 6px;
}
input.apo-agg-month {
  padding: 4px 8px; border: 1px solid #ccc; border-radius: 4px; font-size: 13px;
}

#apo-agg-progress {
  margin-top: 8px; height: 6px; background: #eee; border-radius: 3px; overflow: hidden;
  display: none;
}
#apo-agg-progress > div {
  height: 100%; background: #4a90e2; width: 0%; transition: width .2s;
}
#apo-agg-status { font-size: 12px; color: #555; margin-top: 4px; min-height: 1em; }

.apo-agg-tabs { display: flex; gap: 4px; margin-top: 12px; border-bottom: 1px solid #ddd; }
.apo-agg-tab {
  padding: 6px 14px; cursor: pointer; border: 1px solid #ddd; border-bottom: none;
  border-radius: 4px 4px 0 0; background: #f0f0f0; font-size: 13px;
}
.apo-agg-tab.active { background: #fff; font-weight: bold; }

.apo-agg-pane { display: none; padding-top: 12px; }
.apo-agg-pane.active { display: block; }

.apo-agg-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
}
@media (max-width: 800px) { .apo-agg-grid { grid-template-columns: 1fr; } }

.apo-agg-card {
  border: 1px solid #e0e0e0; border-radius: 6px; padding: 10px;
  background: #fafafa;
}
.apo-agg-card h3 { margin: 0 0 8px; font-size: 14px; color: #333; }

.apo-agg-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.apo-agg-table th, .apo-agg-table td {
  border: 1px solid #ddd; padding: 4px 6px; text-align: right;
}
.apo-agg-table th:first-child, .apo-agg-table td:first-child { text-align: left; }
.apo-agg-table thead th { background: #eef3f9; }
.apo-agg-table tfoot td { font-weight: bold; background: #f5f5f5; }

#apo-agg-trend-chart { width: 100%; }
.apo-agg-history-list { font-size: 13px; }
.apo-agg-history-list li {
  padding: 4px 0; display: flex; align-items: center; gap: 8px;
}
.apo-agg-history-list a { color: #4a90e2; cursor: pointer; }
.apo-agg-history-list .del {
  margin-left: auto; color: #d9534f; cursor: pointer; font-size: 11px;
}
