/* ERP dashboard (templates/dashboard2.html + js/controllers/dashboard2Ctrl.js).
   Scoped under .dash2 so it never leaks into the global style.css rules. */

.dash2 {
  padding: 0.5rem 0 2rem;
}

/* ------------------------------------------------------------- range bar */
.dash2-rangebar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.dash2-rangebar .dash2-range-btn {
  border: 1px solid #d4d8e0;
  background: #fff;
  border-radius: 6px;
  padding: 0.3rem 0.9rem;
  font-size: 0.85rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.dash2-rangebar .dash2-range-btn.active {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

.dash2-rangebar .dash2-custom-dates {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
}

.dash2-rangebar input[type="date"] {
  border: 1px solid #d4d8e0;
  border-radius: 6px;
  padding: 0.25rem 0.5rem;
  font-size: 0.85rem;
}

/* ------------------------------------------------------------- KPI cards */
.dash2-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.dash2-kpi {
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: 10px;
  padding: 0.9rem 1rem;
  min-height: 118px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.dash2-kpi .dash2-kpi-icon {
  font-size: 1.5rem;
  color: #1f6feb;
}

.dash2-kpi .dash2-kpi-label {
  font-size: 0.8rem;
  color: #6b7280;
  margin: 0.35rem 0 0.15rem;
}

.dash2-kpi .dash2-kpi-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: #111827;
  line-height: 1.2;
  word-break: break-word;
}

.dash2-kpi .dash2-kpi-value.negative {
  color: #dc2626;
}

.dash2-kpi .dash2-kpi-sub {
  font-size: 0.75rem;
  color: #9ca3af;
  margin-top: 0.25rem;
}

.dash2-kpi .dash2-kpi-sub b {
  color: #4b5563;
}

.dash2-kpi.dash2-kpi-wide {
  grid-column: 1 / -1;
  min-height: 80px;
}

/* ------------------------------------------------------------ chart cards */
.dash2-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 0.75rem;
}

.dash2-card {
  background: #fff;
  border: 1px solid #e6e9ef;
  border-radius: 10px;
  padding: 1rem;
  grid-column: span 4;
  min-height: 340px;
  display: flex;
  flex-direction: column;
}

.dash2-card.dash2-span-6 {
  grid-column: span 6;
}

.dash2-card.dash2-span-8 {
  grid-column: span 8;
}

.dash2-card h5 {
  font-size: 0.95rem;
  font-weight: 600;
  color: #111827;
  margin: 0 0 0.75rem;
}

.dash2-chart {
  flex: 1;
  min-height: 260px;
  width: 100%;
}

/* ------------------------------------------------------------------ lists */
.dash2-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.dash2-list li {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f1f3f7;
  font-size: 0.85rem;
}

.dash2-list li:last-child {
  border-bottom: none;
}

.dash2-list .dash2-list-main {
  min-width: 0;
}

.dash2-list .dash2-list-title {
  color: #111827;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dash2-list .dash2-list-meta {
  color: #9ca3af;
  font-size: 0.75rem;
}

.dash2-list .dash2-list-amount {
  font-weight: 700;
  color: #111827;
  white-space: nowrap;
}

.dash2-list .dash2-list-amount.refund {
  color: #dc2626;
}

.dash2-badge {
  display: inline-block;
  border-radius: 10px;
  padding: 0 0.45rem;
  font-size: 0.7rem;
  line-height: 1.5;
  background: #eef2ff;
  color: #1f6feb;
}

.dash2-badge.workshop {
  background: #fdf4e7;
  color: #b45309;
}

.dash2-badge.low {
  background: #fee2e2;
  color: #b91c1c;
}

/* ------------------------------------------------------- loading / empty */
.dash2-state {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  color: #9ca3af;
  font-size: 0.85rem;
  text-align: center;
}

.dash2-state .spinner-border {
  width: 1.4rem;
  height: 1.4rem;
  margin-inline-end: 0.5rem;
  vertical-align: middle;
}

/* ------------------------------------------------------------- responsive */
@media (max-width: 1400px) {
  .dash2-kpi-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1200px) {
  .dash2-card,
  .dash2-card.dash2-span-6,
  .dash2-card.dash2-span-8 {
    grid-column: span 6;
  }
}

@media (max-width: 768px) {
  .dash2-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .dash2-card,
  .dash2-card.dash2-span-6,
  .dash2-card.dash2-span-8 {
    grid-column: span 12;
  }
}

@media (max-width: 480px) {
  .dash2-kpi-grid {
    grid-template-columns: 1fr;
  }
}
