/* Dashboard page styles */
/* ---------- Stat cards ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 16px;
}

.stat {
  height: 156px;
  padding: 20px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  display: flex;
  flex-direction: column;
}
.stat-peach { background: #FDF1E7; border-color: #F9DFC9; }
.stat-green { background: #EAF7EF; border-color: #CFEBDA; }
.stat-blue  { background: #EAF4FB; border-color: #D4E8F6; }
.stat-pink  { background: #F3EBF7; border-color: #E5D3EE; }

.stat-top { display: flex; align-items: flex-start; justify-content: space-between; }
.stat-label { font-size: 14.5px; color: #4A4A4A; margin-top: 2px; }
.stat-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: #fff;
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 8px;
  color: var(--text);
  margin-top: -2px;
}
.stat-value { font-size: 30px; font-weight: 700; letter-spacing: -0.6px; margin-top: 8px; }
.stat-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; }
.delta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  background: #fff;
  border-radius: 6px;
  color: #219653;
  font-size: 12.5px;
  font-weight: 600;
}
.delta i { display: grid; place-items: center; }
.stat-note { font-size: 12.5px; color: #8A8A8E; }

.row { display: grid; gap: 16px; margin-top: 16px; }
.row-orders { grid-template-columns: 2fr 1fr; }
.row-bottom { grid-template-columns: 5fr 7fr; }

/* ---------- Recent orders table ---------- */
.table-scroll { overflow-x: auto; }
table.orders {
  width: 100%;
  min-width: 1120px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.orders th, .orders td { text-align: left; padding: 0 10px 0 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.orders th:nth-child(1) { width: 110px; }
.orders th:nth-child(2) { width: 190px; }
.orders th:nth-child(3) { width: 250px; }
.orders th:nth-child(4) { width: 115px; }
.orders th:nth-child(5) { width: 120px; }
.orders th:nth-child(6) { width: 145px; }
.orders th:nth-child(7) { width: 130px; }

.orders thead th {
  height: 38px;
  background: #F4F6F5;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}
.orders thead th:first-child { border-radius: 8px 0 0 8px; }
.orders thead th:last-child { border-radius: 0 8px 8px 0; }

.orders tbody td {
  height: 59px;
  font-size: 15px;
  color: #1F1F1F;
  border-bottom: 1px solid #EAEAEA;
}
.orders tbody tr:last-child td { border-bottom: 0; }
.orders tbody tr.dashboard-order-row { cursor: pointer; }
.orders tbody tr.dashboard-order-row:hover { background: #F7FAF8; }
.orders tbody tr.dashboard-order-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.orders td.order-id { font-weight: 600; color: var(--text); }
.orders td.muted { color: var(--muted); }
.orders td.amount { font-weight: 700; color: var(--text); }
.orders .order-product-count, .orders .order-product-summary { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dashboard-order-product { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dashboard-order-product > div { min-width: 0; flex: 1; overflow: hidden; }
.dashboard-order-product .order-product-thumb { width: 36px; height: 36px; flex: 0 0 36px; display: block; border-radius: 7px; background: #F4F6F5; object-fit: cover; }
.dashboard-order-product .order-product-thumb-empty { border: 1px solid var(--border); }
.orders .order-product-count { font-size: 13.5px; font-weight: 600; }
.orders .order-product-summary { margin-top: 3px; color: var(--muted); font-size: 12px; }

.cust { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); }
.cust-name { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cust img, .cust .ph {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  background: #EDEFEE;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 600;
  color: #4A4A4A;
}

/* ---------- Top selling products ---------- */
.top-products { list-style: none; margin: 0; padding: 0; }
.top-products li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #EAEAEA;
}
.top-products li:first-child { padding-top: 0; }
.top-products li:last-child { border-bottom: 0; }

.tp-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #1F1F1F;
}
.tp-product-image { object-fit: cover; background: #F4F6F5; }
.tp-product-image-empty { border: 1px solid var(--border); }
.tp-info { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.tp-info strong { font-size: 14.5px; font-weight: 500; }
.tp-info small { font-size: 13px; color: var(--muted); }
.tp-sales { text-align: right; display: flex; flex-direction: column; gap: 2px; }
.tp-sales strong { font-size: 14.5px; font-weight: 600; }
.tp-sales small { font-size: 12.5px; color: var(--muted); }

/* ---------- Customer overview ---------- */
.customer .pill { height: 24px; }
.cust-boxes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 18px; }
.cust-box {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cust-box span { font-size: 13px; color: var(--muted); }
.cust-box strong { font-size: 24px; font-weight: 700; letter-spacing: -0.4px; }

.split-labels { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.split-labels strong { color: var(--text); font-weight: 600; }
.split-bar { height: 8px; border-radius: 999px; background: var(--primary-soft); overflow: hidden; }
.split-bar i { display: block; height: 100%; background: var(--primary); }

.growth { margin-top: 16px; }
.growth-head { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--muted); }
.growth-val { display: inline-flex; align-items: center; gap: 4px; color: #219653; font-weight: 500; }
.growth-val i { display: grid; place-items: center; }
.spark { display: block; width: 100%; height: 88px; margin-top: 8px; }

/* ---------- Low stock ---------- */
.low-stock { list-style: none; margin: 0; padding: 0; }
.low-stock li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px solid #EAEAEA;
}
.low-stock li:first-child { padding-top: 4px; }
.low-stock li:last-child { border-bottom: 0; }

.ls-name { display: flex; flex-direction: column; gap: 3px; }
.ls-name strong { font-size: 15px; font-weight: 500; }
.ls-name small { font-size: 12.5px; color: var(--muted); }

.ls-right { display: flex; align-items: center; gap: 12px; }
.ls-meter { width: auto; }
.ls-bar { width: 110px; height: 6px; border-radius: 999px; background: #EDEFEE; overflow: hidden; }
.ls-bar i { display: block; height: 100%; border-radius: 999px; }
.ls-bar i.critical { background: #E74C3C; }
.ls-bar i.low { background: #E67E22; }
.ls-meter small { display: block; margin-top: 5px; font-size: 12.5px; color: var(--muted); white-space: nowrap; }

.reorder {
  height: 32px;
  padding: 0 12px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .row-orders, .row-bottom { grid-template-columns: 1fr; }
}


/* ---------- Store report popup ---------- */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.modal-dialog {
  position: relative;
  width: 100%;
  max-width: 486px;
  max-height: calc(100vh - 32px);
  overflow-y: auto;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.25);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 20px; font-weight: 500; letter-spacing: -0.2px; }
.modal-close {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--text);
}
.modal-close:hover { background: #F4F6F5; }
.modal-body { padding: 16px; }
.report-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.report-box {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
}
.report-box small { font-size: 12.5px; color: var(--muted); }
.report-box strong { font-size: 24px; font-weight: 700; letter-spacing: -0.4px; }
.report-box em { font-size: 12.5px; font-style: normal; font-weight: 500; color: var(--primary-dark); }
.report-note { margin: 12px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px;
  border-top: 1px solid var(--border);
}
