.dashboard-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.dashboard-head h1,
.dashboard-head p {
  margin: 0;
}

.dashboard-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.dashboard-date {
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 800;
}

.dashboard-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 11px;
  margin-bottom: 17px;
}

.dashboard-stat {
  position: relative;
  min-height: 105px;
  overflow: hidden;
  padding: 17px;
}

.dashboard-stat small,
.dashboard-stat b {
  position: relative;
  z-index: 1;
  display: block;
}

.dashboard-stat small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
}

.dashboard-stat b {
  margin-top: 8px;
  color: var(--brand);
  font-size: 25px;
  letter-spacing: -.5px;
}

.dashboard-stat::after {
  content: "";
  position: absolute;
  top: -31px;
  right: -25px;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  background: var(--brand-soft);
}

.dashboard-stat:nth-child(2)::after,
.dashboard-stat:nth-child(5)::after {
  background: #fbf3df;
}

.dashboard-stat:nth-child(3)::after,
.dashboard-stat:nth-child(6)::after {
  background: #eaf1fb;
}

.dashboard-stat.outstanding b {
  color: #a53b32;
}

.dashboard-quick {
  padding: 17px 20px;
}

.dashboard-quick h2 {
  margin-bottom: 13px;
}

.dashboard-quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 9px;
}

.dashboard-quick-actions .btn {
  gap: 7px;
  min-height: 43px;
}

.dashboard-quick-actions .icon {
  font-size: 16px;
}

.dashboard-panels {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 14px;
}

.dashboard-panel {
  padding: 18px 20px;
}

.dashboard-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 13px;
}

.dashboard-panel-head h2 {
  margin: 0;
}

.dashboard-panel-head a {
  font-size: 10px;
  font-weight: 750;
}

.dashboard-table-wrap {
  overflow-x: auto;
}

.dashboard-table {
  min-width: 570px;
}

.dashboard-table th,
.dashboard-table td {
  padding: 10px 9px;
}

.dashboard-customer b,
.dashboard-customer small {
  display: block;
}

.dashboard-customer small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.dashboard-row-actions {
  display: flex;
  gap: 5px;
  white-space: nowrap;
}

.dashboard-row-actions .btn {
  padding: 6px 8px;
  border-radius: 7px;
  font-size: 9px;
  box-shadow: none;
}

.dashboard-empty {
  padding: 25px !important;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1050px) {
  .dashboard-panels {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .dashboard-head {
    align-items: center;
  }

  .dashboard-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .dashboard-stat {
    min-height: 93px;
    padding: 14px;
  }

  .dashboard-stat b {
    font-size: 20px;
  }

  .dashboard-quick-actions {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-quick-actions .btn {
    min-width: 0;
    font-size: 11px;
  }

  .dashboard-panel {
    padding: 15px;
  }
}


/* Mobile dashboard: compact cards instead of horizontally scrolling tables. */
@media (max-width: 700px) {
  .page-dashboard .wrap { padding-left: 10px !important; padding-right: 10px !important; }
  .dashboard-head { align-items: flex-start; gap: 10px; margin-bottom: 12px; }
  .dashboard-head h1 { font-size: 24px; line-height: 1.15; }
  .dashboard-head p { font-size: 10px; line-height: 1.4; }
  .dashboard-date { padding: 7px 9px; font-size: 9px; white-space: nowrap; }
  .dashboard-stats { gap: 7px; margin-bottom: 10px; }
  .dashboard-stat { min-height: 76px; padding: 11px; border-radius: 12px; }
  .dashboard-stat small { font-size: 8.5px; }
  .dashboard-stat b { margin-top: 5px; font-size: 18px; }
  .dashboard-quick { padding: 12px; margin-bottom: 10px; }
  .dashboard-quick h2 { margin-bottom: 9px; font-size: 15px; }
  .dashboard-quick-actions { gap: 7px; }
  .dashboard-quick-actions .btn { min-height: 38px; padding: 8px 9px; font-size: 10px; }
  .dashboard-panel { padding: 12px 10px; margin-bottom: 10px; }
  .dashboard-panel-head { margin-bottom: 8px; }
  .dashboard-panel-head h2 { font-size: 15px; }
  .dashboard-panel-head a { font-size: 9px; }
  .dashboard-table-wrap { overflow: visible; }
  .dashboard-table,
  .dashboard-table tbody { display: block; width: 100%; min-width: 0; overflow: visible; white-space: normal; }
  .dashboard-table thead { display: none; }
  .dashboard-table tbody tr { display: grid; width: 100%; padding: 9px 2px; border-bottom: 1px solid #e5ede8; background: transparent; box-shadow: none; }
  .dashboard-table tbody tr:last-child { border-bottom: 0; }
  .dashboard-table tbody td { display: block; min-width: 0; padding: 0; border: 0; white-space: normal; }

  .dashboard-panels > .dashboard-panel:first-child .dashboard-table tbody tr {
    grid-template-columns: minmax(0,1fr) auto;
    grid-template-areas:
      "customer amount"
      "meta actions";
    gap: 4px 9px;
    align-items: center;
  }
  .dashboard-panels > .dashboard-panel:first-child .dashboard-table td:nth-child(1),
  .dashboard-panels > .dashboard-panel:first-child .dashboard-table td:nth-child(2) {
    grid-area: meta;
    display: inline;
    color: #74847b;
    font-size: 8.5px;
  }
  .dashboard-panels > .dashboard-panel:first-child .dashboard-table td:nth-child(1)::after { content: " · "; }
  .dashboard-panels > .dashboard-panel:first-child .dashboard-table td:nth-child(3) {
    grid-area: customer;
    color: #263d32;
    font-size: 11.5px;
    font-weight: 800;
    overflow-wrap: anywhere;
  }
  .dashboard-panels > .dashboard-panel:first-child .dashboard-table td:nth-child(4) {
    grid-area: amount;
    color: #155f3b;
    font-size: 12px;
    text-align: right !important;
    white-space: nowrap;
  }
  .dashboard-panels > .dashboard-panel:first-child .dashboard-table td:nth-child(5) {
    grid-area: actions;
    justify-self: end;
  }

  .dashboard-panels > .dashboard-panel:last-child .dashboard-table tbody tr {
    grid-template-columns: minmax(0,1fr) auto;
    grid-template-areas:
      "customer balance"
      "customer actions";
    gap: 5px 9px;
    align-items: center;
  }
  .dashboard-panels > .dashboard-panel:last-child .dashboard-table td:nth-child(1) { grid-area: customer; }
  .dashboard-panels > .dashboard-panel:last-child .dashboard-table td:nth-child(2) {
    grid-area: balance;
    text-align: right !important;
    white-space: nowrap;
    font-size: 11.5px;
  }
  .dashboard-panels > .dashboard-panel:last-child .dashboard-table td:nth-child(3) {
    grid-area: actions;
    justify-self: end;
  }
  .dashboard-customer b { font-size: 11.5px; line-height: 1.3; }
  .dashboard-customer small { margin-top: 2px; max-width: 210px; overflow: hidden; font-size: 8px; text-overflow: ellipsis; white-space: nowrap; }
  .dashboard-row-actions { gap: 4px; }
  .dashboard-row-actions .btn { min-height: 28px; padding: 5px 7px; font-size: 8px; }
  .dashboard-empty { display: block !important; padding: 16px 6px !important; font-size: 10px; }
}
