.history-filter-card,
.history-brand-card {
  margin-bottom: 16px;
  overflow: hidden;
  border: 1px solid rgba(222, 232, 224, .9);
  border-radius: 16px;
  background: rgba(255, 255, 255, .82);
  box-shadow: 0 12px 36px rgba(31, 74, 52, .04);
}

.history-filter-card { padding: 18px; }
.history-view-tabs {
  display: inline-flex;
  gap: 5px;
  margin: 0 0 16px;
  padding: 5px;
  border: 1px solid rgba(215, 230, 220, .95);
  border-radius: 13px;
  background: rgba(244, 249, 245, .88);
}
.history-view-tabs button {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font: 700 12px inherit;
  cursor: pointer;
}
.history-view-tabs button.active {
  background: var(--green);
  color: #fff;
  box-shadow: 0 7px 18px rgba(23, 107, 71, .18);
}
.history-filter-heading,
.history-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.history-filter-heading { margin-bottom: 15px; }
.history-filter-heading h2,
.history-section-heading h2,
.history-detail-card .table-tools h2 {
  margin: 0;
  color: var(--ink);
  font-size: 16px;
}
.history-filter-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.history-reset-button {
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid #d7e6dc;
  border-radius: 10px;
  background: #f2f7f3;
  color: var(--green);
  font: 700 12px inherit;
  cursor: pointer;
}
.history-reset-button:hover { border-color: #9fc8ae; background: #eaf5ee; }

.history-filter-grid {
  display: grid;
  grid-template-columns: minmax(260px, 1.7fr) repeat(5, minmax(125px, 1fr));
  gap: 10px;
  align-items: end;
}
.history-filter-grid > label { display: grid; min-width: 0; gap: 6px; }
.history-filter-grid > label > span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}
.history-filter-grid input,
.history-filter-grid select {
  width: 100%;
  min-width: 0;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
  background: rgba(255, 255, 255, .9);
  color: var(--ink);
  font: 600 12px inherit;
}
.history-filter-grid input { padding: 0 11px; }
.history-filter-grid select { padding: 0 30px 0 11px; }
.history-filter-grid input:focus,
.history-filter-grid select:focus {
  border-color: #61a37e;
  box-shadow: 0 0 0 3px rgba(71, 148, 104, .12);
}
.history-search-filter .search { height: 44px; max-width: none; padding: 0 12px; }
.history-search-filter .search b { color: #8da096; font-size: 18px; font-weight: 500; }
.history-search-filter .search input { height: 40px; padding: 0; border: 0; border-radius: 0; box-shadow: none; background: transparent; }

.history-section-heading {
  align-items: center;
  padding: 17px 19px;
  border-bottom: 1px solid var(--line);
}
.history-section-heading .eyebrow,
.history-detail-card .table-tools .eyebrow { margin-bottom: 4px; }
.history-section-heading > span,
.history-detail-card .table-tools > span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}
.history-brand-table { min-width: 820px; }
.history-brand-table td { white-space: nowrap; }
.history-brand-name {
  display: inline-flex;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eaf5ee;
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
}
.history-discount-value { color: #b66c37; }
.history-net-value { color: var(--green); }
.history-detail-card { margin-bottom: 24px; }
.history-detail-card .table-tools { justify-content: space-between; }
.history-detail-card .table-tools > span { margin-left: 0; }

@media (max-width: 1280px) {
  .history-filter-grid { grid-template-columns: minmax(260px, 2fr) repeat(3, minmax(135px, 1fr)); }
  .history-filter-grid > label:nth-child(5),
  .history-filter-grid > label:nth-child(6) { grid-column: span 1; }
}

@media (max-width: 820px) {
  .history-filter-card { padding: 15px; }
  .history-filter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .history-search-filter { grid-column: 1 / -1; }
  .history-filter-grid input,
  .history-filter-grid select,
  .history-search-filter .search,
  .history-reset-button { min-height: 44px; }
  .history-brand-card { border-radius: 13px; }
}

@media (max-width: 520px) {
  .history-filter-heading { align-items: stretch; flex-direction: column; }
  .history-filter-grid { grid-template-columns: 1fr; }
  .history-search-filter { grid-column: auto; }
  .history-section-heading { align-items: flex-start; flex-direction: column; gap: 7px; }
  .history-section-heading > span { white-space: normal; }
  .history-view-tabs { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .history-view-tabs button { min-width: 0; padding: 0 10px; }
}
