/* ---------- بطاقات الأرقام ---------- */
.kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 14px;
}

/* ---------- الصفوف ---------- */
.row-wide,
.row-3 {
  display: grid;
  gap: var(--am-space-4);
}

.row-wide {
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
}

.row-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

/* ---------- رسم 12 شهر ---------- */
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--am-muted);
  font-size: var(--am-text-xs);
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.legend .in,
.bars .in {
  background: var(--chart-income);
}

.legend .out,
.bars .out {
  background: var(--chart-out);
}

.chart {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--am-space-2);
  padding: 0 22px 18px;
}

.chart-col {
  display: grid;
  gap: 6px;
  justify-items: center;
  color: var(--am-muted);
  font-size: 11px;
}

.chart-col.now {
  color: var(--am-text);
  font-weight: 700;
}

.bars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 3px;
  width: 100%;
  height: 190px;
  border-bottom: 1px solid var(--am-border);
}

.bars i {
  width: 38%;
  max-width: 22px;
  border-radius: 4px 4px 0 0;
}

/* ---------- أقرب الدفعات ---------- */
.rows {
  margin: 0;
  padding: 0;
  list-style: none;
}

.rows li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: var(--am-space-3);
  align-items: center;
  padding: 12px 22px;
  border-top: 1px solid var(--am-border);
}

.rows .tile {
  width: 34px;
  height: 34px;
}

.rows strong {
  display: block;
  font-weight: 600;
}

.rows small {
  color: var(--am-muted);
  font-size: var(--am-text-xs);
}

.rows .end {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.rows .end b {
  font-size: 15px;
}

.table tr.now td {
  background: #fbf6f7;
  font-weight: 700;
}

/* ---------- الدونات والأعمدة الأفقية ---------- */
.donut-wrap {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: var(--am-space-5);
  align-items: center;
  padding: 0 22px 20px;
}

.donut {
  position: relative;
  width: 150px;
  aspect-ratio: 1;
  border-radius: 50%;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background: var(--am-surface);
}

.donut div {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: grid;
  place-content: center;
  text-align: center;
}

.donut strong {
  font-size: 20px;
  font-weight: 800;
}

.donut small {
  color: var(--am-muted);
  font-size: 11px;
}

.keys {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: var(--am-text-sm);
}

.keys li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: var(--am-space-2);
  align-items: center;
}

.keys i {
  width: 10px;
  height: 10px;
  border-radius: 2px;
}

.hbars {
  display: grid;
  gap: 14px;
  padding: 0 22px 20px;
}

@media (max-width: 1200px) {
  .kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .row-wide,
  .row-3 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 900px) {
  .kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .chart {
    grid-template-columns: repeat(12, 44px);
    overflow-x: auto;
  }

  .donut-wrap {
    grid-template-columns: minmax(0, 1fr);
    justify-items: center;
  }

  .keys {
    width: 100%;
  }
}
