/* ==========================================================
   DASHBOARD SPECIFIC STYLES
   (extends style.css tokens/components)
   ========================================================== */

.range-select {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
}
.range-select:focus { border-color: var(--primary); }

/* ===== KPI GRID ===== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin: 20px 24px 0;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  position: relative;
  overflow: hidden;
}
.kpi-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--kpi-accent, var(--primary));
  opacity: 0;
  transition: opacity 0.2s;
}
.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}
.kpi-card:hover::before { opacity: 1; }

.kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.kpi-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px;
  background: var(--kpi-bg, var(--primary-light));
  color: var(--kpi-accent, var(--primary));
  flex-shrink: 0;
}
.kpi-trend {
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.kpi-trend.up { background: var(--emerald-light); color: var(--emerald-dark); }
.kpi-trend.down { background: var(--danger-light); color: var(--danger); }

.kpi-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-soft);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.kpi-value {
  font-size: 22px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.3px;
}
.kpi-sub {
  font-size: 11.5px;
  color: var(--text-faint);
}

/* ===== CHART GRIDS ===== */
.chart-grid {
  display: grid;
  gap: 20px;
  margin: 20px 24px 0;
}
.chart-grid-2 { grid-template-columns: 1.4fr 1fr; }
.chart-grid-3 { grid-template-columns: repeat(3, 1fr); }
.chart-grid-timeline { grid-template-columns: 0.9fr 1.6fr; align-items: start; }

.chart-card { margin: 0; display: flex; flex-direction: column; }
.chart-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 10px;
}
.chart-card-header h3 {
  margin: 0 0 2px;
  font-size: 14.5px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.chart-card-header h3 i { color: var(--primary); font-size: 13px; }
.chart-card-header small { color: var(--text-faint); font-size: 11.5px; }

.chart-actions { display: flex; gap: 6px; flex-shrink: 0; }
.icon-btn-sm {
  width: 30px; height: 30px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-soft);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  font-size: 12px;
  transition: background 0.15s, color 0.15s;
}
.icon-btn-sm:hover { background: var(--primary-light); color: var(--primary-dark); }

.chart-canvas-wrap { position: relative; height: 280px; width: 100%; }
.chart-canvas-wrap-sm { height: 220px; }

/* ===== ACTIVITY TIMELINE ===== */
.timeline-card { padding-bottom: 8px; }
.activity-timeline {
  display: flex;
  flex-direction: column;
  max-height: 480px;
  overflow-y: auto;
  padding-right: 4px;
}

.activity-item {
  display: flex;
  gap: 14px;
  padding: 12px 4px;
  position: relative;
}
.activity-item:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 40px;
  bottom: -4px;
  width: 2px;
  background: var(--border);
}
.activity-dot {
  width: 40px; height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  z-index: 1;
}
.activity-dot.type-post { background: var(--emerald-light); color: var(--emerald-dark); }
.activity-dot.type-edit { background: var(--primary-light); color: var(--primary-dark); }
.activity-dot.type-delete { background: var(--danger-light); color: var(--danger); }
.activity-dot.type-approve { background: var(--warning-light); color: #92400e; }

.activity-body { flex: 1; padding-top: 2px; }
.activity-title { font-size: 13px; font-weight: 600; margin: 0 0 2px; }
.activity-meta { font-size: 11.5px; color: var(--text-faint); }

/* ===== TRANSACTIONS TABLE ===== */
.transactions-card { padding-bottom: 12px; }
.table-toolbar { display: flex; align-items: center; gap: 10px; }
.table-search {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  color: var(--text-faint);
}
.table-search input {
  border: none; outline: none; background: transparent;
  font-size: 13px; color: var(--text); width: 180px;
}

.table-responsive { overflow-x: auto; }

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--text-soft);
  border-bottom: 2px solid var(--border-strong);
  cursor: pointer;
  white-space: nowrap;
  user-select: none;
}
.data-table thead th i { margin-left: 4px; font-size: 10px; opacity: 0.5; }
.data-table thead th:hover { color: var(--primary); }
.data-table thead th.sorted i { opacity: 1; color: var(--primary); }

.data-table tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.data-table tbody tr { transition: background 0.12s; }
.data-table tbody tr:hover { background: var(--surface-2); }
.text-right { text-align: right; font-variant-numeric: tabular-nums; }

.status-pill {
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.2px;
}
.status-pill.posted { background: var(--emerald-light); color: var(--emerald-dark); }
.status-pill.draft { background: var(--warning-light); color: #92400e; }
.status-pill.pending { background: var(--primary-light); color: var(--primary-dark); }
.status-pill.void { background: var(--danger-light); color: var(--danger); }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 4px 4px;
  font-size: 12.5px;
  color: var(--text-faint);
  flex-wrap: wrap;
  gap: 10px;
}
.pagination { display: flex; gap: 4px; }
.page-btn {
  width: 30px; height: 30px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-soft);
  transition: background 0.15s, color 0.15s;
}
.page-btn:hover { background: var(--surface-2); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 40px 20px;
  color: var(--text-faint);
  gap: 10px;
  text-align: center;
}
.empty-state i { font-size: 32px; opacity: 0.5; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1440px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1200px) {
  .chart-grid-2, .chart-grid-3, .chart-grid-timeline { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 1024px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; margin: 16px 12px 0; gap: 12px; }
  .chart-grid { margin: 16px 12px 0; gap: 12px; }
  .chart-grid-2, .chart-grid-3, .chart-grid-timeline { grid-template-columns: 1fr; }
  .table-toolbar { width: 100%; }
  .table-search input { width: 100%; }
}
@media (max-width: 480px) {
  .kpi-grid { grid-template-columns: 1fr; }
}