/* ============================================================
   RESET
   ============================================================ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

/* ============================================================
   CONTENT / LAYOUT WRAPPER
   ============================================================ */
.content {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 28px;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 26px;
}
.page-head h1 {
  font-family: var(--display);
  font-size: 24px;
  font-weight: 700;
}
.page-head p {
  color: var(--mute);
  font-size: 13.5px;
  margin-top: 4px;
}

.date-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13.5px;
  font-weight: 500;
}
.date-pill i.fa-chevron-down {
  font-size: 10px;
  color: var(--mute-2);
}

/* ============================================================
   KPI GRID
   ============================================================ */
.kpi-grid {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}
.kpi-grid > * {
  min-width: 0;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.kpi-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}
.kpi-top span {
  font-size: 13px;
  color: var(--mute);
  font-weight: 500;
}
.kpi-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  color: #fff;
  flex: 0 0 auto;
}
.kpi-icon.blue   { background: var(--blue); }
.kpi-icon.teal   { background: var(--teal); }
.kpi-icon.purple { background: var(--purple); }
.kpi-icon.amber  { background: var(--amber); }

.kpi-value {
  font-family: var(--display);
  font-size: 25px;
  font-weight: 700;
  word-break: break-word;
}
.kpi-change {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--mute);
}
.kpi-change strong {
  color: var(--green);
  font-weight: 700;
}
.kpi-change.down strong {
  color: var(--red);
}

/* ============================================================
   CARD (generic container)
   ============================================================ */
.card {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 100%;
  padding: 22px;
  overflow: hidden;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  gap: 10px;
}
.card-head h2 {
  font-family: var(--display);
  font-size: 15.5px;
  font-weight: 700;
}
.card-link {
  font-size: 12.5px;
  color: var(--blue);
  font-weight: 600;
  white-space: nowrap;
}
.chip-select {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: 100px;
  padding: 7px 14px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}
.chip-select i {
  font-size: 9px;
  color: var(--mute-2);
}

/* ============================================================
   DASHBOARD GRID (sesuai markup dashboard.php)
   ------------------------------------------------------------
   .dash-grid            -> wrapper vertikal semua baris section
   .dash-row              -> 1 baris grid, default 1 kolom
   .dash-row--revenue     -> Revenue Overview (lebar) | Sales by Channel
   .dash-row--two         -> 2 kolom sama besar (Transaksi/Produk, Kalender/Tasks)
   .dash-row--full        -> 1 kolom penuh (Quick Actions)
   ============================================================ */
.dash-grid {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.dash-row {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 18px;
  align-items: stretch;
}
.dash-row > * {
  min-width: 0;
}

.dash-row--revenue {
  grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr);
}

.dash-row--two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.dash-row--full {
  grid-template-columns: minmax(0, 1fr);
}

/* Revenue chart */
.chart-wrap {
  position: relative;
  height: 260px;
  width: 100%;
  overflow: hidden;
}

/* Donut chart */
.donut-wrap {
  position: relative;
  height: 180px;
  width: 100%;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.donut-total {
  position: absolute;
  text-align: center;
}
.donut-total span {
  display: block;
  font-size: 11.5px;
  color: var(--mute);
}
.donut-total strong {
  font-family: var(--display);
  font-size: 19px;
}

.legend {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  min-width: 0;
}
.legend-row .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.legend-row .lg-label {
  flex: 1;
  min-width: 0;
}
.legend-row .lg-label strong {
  display: block;
  font-weight: 600;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.legend-row .lg-label span {
  font-size: 11.5px;
  color: var(--mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.legend-row .lg-val {
  font-weight: 600;
  font-size: 12.5px;
  color: var(--mute);
  flex: 0 0 auto;
}

/* ============================================================
   KALENDER
   ============================================================ */
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.cal-head strong {
  font-family: var(--display);
  font-size: 14.5px;
}
.cal-nav {
  display: flex;
  gap: 4px;
}
.cal-nav button {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: none;
  background: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mute);
  font-size: 11px;
  cursor: pointer;
  transition: background .15s ease;
}
.cal-nav button:hover {
  background: var(--bg);
}
.cal-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
  text-align: center;
}
.cal-grid .dow {
  font-size: 11px;
  color: var(--mute-2);
  font-weight: 600;
  padding-bottom: 6px;
}
.cal-grid .day {
  font-size: 12.5px;
  padding: 7px 0;
  border-radius: 9px;
  color: var(--text);
  cursor: default;
}
.cal-grid .day.muted {
  color: var(--mute-2);
}
.cal-grid .day.today {
  background: var(--blue);
  color: #fff;
  font-weight: 700;
}

/* ============================================================
   LIST ROWS (Transaksi / Produk)
   ============================================================ */
.list-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.list-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.list-row:first-child {
  padding-top: 0;
}
.list-ic {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 14px;
}
.list-thumb {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  color: #fff;
  font-weight: 700;
  font-family: var(--display);
  object-fit: cover;
  background: var(--bg);
}
.list-main {
  flex: 1;
  min-width: 0;
}
.list-main strong {
  display: block;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.list-main span {
  font-size: 12px;
  color: var(--mute);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}
.list-status {
  font-size: 11px;
  font-weight: 700;
  color: var(--green);
  background: var(--teal-soft);
  padding: 4px 10px;
  border-radius: 100px;
  white-space: nowrap;
}
.list-amount {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  margin-left: auto;
  margin-top: 6px;
}
.rank {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--bg);
  color: var(--mute);
  font-size: 11.5px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

/* Empty state (dipakai oleh renderRecent / renderTopProducts) */
.empty-state {
  text-align: center;
  color: var(--mute-2);
  font-size: 13px;
  padding: 24px 0;
}

/* ============================================================
   TASKS
   ============================================================ */
.task-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.task-row:last-child {
  border-bottom: none;
  padding-bottom: 0;
}
.task-row:first-child {
  padding-top: 0;
}
.task-check {
  width: 19px;
  height: 19px;
  border-radius: 6px;
  border: 2px solid var(--border);
  flex: 0 0 auto;
  margin-top: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: #fff;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.task-row.done .task-check {
  background: var(--teal);
  border-color: var(--teal);
}
.task-main strong {
  display: block;
  font-size: 13px;
  font-weight: 600;
}
.task-row.done .task-main strong {
  text-decoration: line-through;
  color: var(--mute);
}
.task-main span {
  font-size: 11.5px;
  color: var(--mute);
}

/* ============================================================
   QUICK ACTIONS
   ============================================================ */
.qa-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.qa-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 12px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  transition: border-color .18s ease, transform .18s ease;
}
.qa-btn:hover {
  border-color: var(--blue);
  transform: translateY(-2px);
}
.qa-btn i {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: #fff;
}

.footer-note {
  text-align: center;
  color: var(--mute-2);
  font-size: 12px;
  padding: 26px 0 10px;
}

/* ============================================================
   MEDIA HELPERS (chart & canvas responsif)
   ============================================================ */
canvas {
  max-width: 100% !important;
}

/* ============================================================
   RESPONSIVE — LAPTOP BESAR / TABLET LANDSCAPE (≤1366px)
   ============================================================ */
@media (max-width: 1366px) {
  .content {
    padding: 22px;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .qa-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ============================================================
   RESPONSIVE — TABLET PORTRAIT (≤992px)
   ============================================================ */
@media (max-width:820px){

    .dash-row--revenue,
    .dash-row--two{
        grid-template-columns:1fr;
    }

  .content {
    padding: 18px;
  }
  .page-head {
    flex-direction: column;
    align-items: flex-start;
  }
  .date-pill {
    width: 100%;
    justify-content: space-between;
  }
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-wrap {
    height: 220px;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE (≤768px)
   ============================================================ */
@media (max-width: 768px) {
  .content {
    padding: 16px;
  }
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .page-head h1 {
    font-size: 22px;
  }
  .card {
    padding: 18px;
  }
  .card-head {
    flex-wrap: wrap;
  }
  .qa-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .cal-grid .day,
  .cal-grid .dow {
    font-size: 11px;
  }
}

/* ============================================================
   RESPONSIVE — MOBILE KECIL (≤480px)
   ============================================================ */
@media (max-width: 480px) {
  .content {
    padding: 14px;
  }
  .qa-grid {
    grid-template-columns: 1fr;
  }
  .kpi-value {
    font-size: 22px;
  }
  .page-head h1 {
    font-size: 20px;
  }
  .chart-wrap {
    height: 190px;
  }
  .donut-wrap {
    height: 160px;
  }
}