.customer-history-shell {
  width: min(1120px, calc(100% - 28px));
  margin: 0 auto;
  padding: 34px 0 60px;
}

.history-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card-bg);
}

.history-topbar h1 {
  margin: 3px 0 6px;
  font-size: clamp(24px, 4vw, 34px);
}

.history-topbar p {
  margin: 0;
  color: var(--muted);
}

.history-top-actions {
  display: flex;
  gap: 9px;
}

.history-state {
  margin-bottom: 14px;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--muted);
  background: var(--surface-soft);
}

.history-state.error {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 35%, var(--border));
}

.customer-history-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.customer-history-card {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  gap: 17px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: var(--card-bg);
}

.customer-history-card.paid {
  border-color: color-mix(in srgb, var(--success) 45%, var(--border));
}

.history-qr {
  position: relative;
  display: block;
  width: 150px;
  height: 150px;
  padding: 7px;
  border-radius: 13px;
  background: #fff;
}

.history-qr img {
  width: 100%;
  height: 100%;
}

.history-paid-check {
  position: absolute;
  top: -8px;
  right: -8px;
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border: 3px solid var(--card-bg);
  border-radius: 50%;
  color: #fff;
  background: var(--success);
  font-weight: 900;
}

.history-card-copy {
  min-width: 0;
}

.history-card-copy h2 {
  margin: 0 0 8px;
  font-size: 17px;
}

.history-meta {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 12px;
}

.history-meta strong {
  color: var(--text);
}

.history-link {
  display: block;
  overflow: hidden;
  margin-bottom: 12px;
  color: var(--primary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.history-complaint-note {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 12px;
}

@media (max-width: 820px) {
  .customer-history-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .history-topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .history-top-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .customer-history-card {
    grid-template-columns: 1fr;
  }

  .history-qr {
    width: min(220px, 100%);
    height: auto;
    aspect-ratio: 1;
    margin: 0 auto;
  }
}
