/* Shared report sections, controls, status pills, groups and tables.
 * Used by sales, catalog, marketing, operations and customer reports. */

.report-section {
  margin-top: 22px;
}

.report-section__head {
  margin-bottom: 14px;
}

.report-section__head h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.report-section__head p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--k-color-muted);
}

.report-notice {
  margin: 14px 0 0;
}

/* Labelled controls in a panel head: the label is part of the control, set
   over it in the meta voice, so a row of selects says what each one changes. */
.report-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 12px;
}

/* `.button` sets a display, which outranks the `hidden` attribute the
   submit-on-change controller uses to retire the button it replaces. */
.report-controls [hidden] {
  display: none;
}

.report-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--k-color-muted);
}

.report-field select,
.report-field input {
  min-height: 36px;
  padding: 6px 10px;
  font: inherit;
  font-family: var(--sans);
  font-size: 13px;
  color: var(--k-color-ink);
  background: var(--k-color-paper);
  border: 1px solid var(--k-color-control-border);
  border-radius: var(--k-radius-control);
}

/* The native arrow sits flush against the border and differs per browser; a
   drawn chevron, inset like the text, matches the admin's selects. */
.report-field select {
  appearance: none;
  padding-right: 36px;
  /* Two 1.5px diagonals, "\" then "/", drawn as a stroke rather than a filled
     triangle so it reads like the rail's brand switcher. */
  background-image:
    linear-gradient(to top right, transparent calc(50% - 0.75px), var(--k-color-muted) calc(50% - 0.75px), var(--k-color-muted) calc(50% + 0.75px), transparent calc(50% + 0.75px)),
    linear-gradient(to top left, transparent calc(50% - 0.75px), var(--k-color-muted) calc(50% - 0.75px), var(--k-color-muted) calc(50% + 0.75px), transparent calc(50% + 0.75px));
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%;
  background-size: 6px 6px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.report-field select:hover {
  border-color: var(--k-color-ink);
}

.report-field--search input {
  width: min(240px, 60vw);
}

.report-link {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: var(--k-color-violet-deep);
  text-decoration: none;
  white-space: nowrap;
}

.report-link:hover {
  text-decoration: underline;
  text-underline-offset: 4px;
}

/* Alert rules */
.report-rules {
  margin: 0;
  padding: 0;
  list-style: none;
}

.report-rule {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  padding: 14px 20px;
  border-bottom: 1px solid var(--k-color-line);
}

.report-rule:last-child {
  border-bottom: 0;
}

.report-rule p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.report-rule__reason {
  margin-top: 2px !important;
  color: var(--k-color-muted);
}

.report-pill {
  justify-self: start;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  white-space: nowrap;
}

.report-pill--warning {
  color: var(--k-color-warning);
  background: var(--k-color-warning-bg);
}

.report-pill--error {
  color: var(--k-color-error);
  background: var(--k-color-error-bg);
}

/* Groups */
.report-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.report-group {
  display: flex;
  flex-direction: column;
}

.report-group .panel-head {
  align-items: flex-start;
}

.report-marker {
  display: inline-block;
  width: 7px;
  height: 18px;
  margin-inline-end: 10px;
  vertical-align: -3px;
  border-radius: 3px;
}

.report-marker--violet { background: var(--k-color-violet); }
.report-marker--mint { background: var(--k-color-mint); }
.report-marker--coral { background: var(--k-color-coral); }
.report-marker--sky { background: var(--k-color-sky); }

.report-group__note {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--k-color-muted);
}

.report-group__unavailable {
  max-width: 52ch;
  margin: 0;
  padding: 22px 20px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--k-color-muted);
}

.report-group__foot {
  margin-top: auto;
  padding: 12px 20px;
  border-top: 1px solid var(--k-color-line);
}

/* Tables. A product row is a name over its identifiers, so rows pad rather
   than hold the channel table's fixed height — as the directory's do. */
.report-scroll {
  padding: 14px 20px 0;
}

.report-table {
  min-width: 820px;
}

.report-table--group {
  min-width: 0;
}

.report-table tbody th,
.report-table tbody td {
  height: auto;
  padding: 12px 0 12px 16px;
  vertical-align: top;
}

.report-table tbody th {
  padding-inline-start: 0;
  white-space: normal;
}

.report-entity {
  display: block;
  font-size: 13px;
  font-weight: 700;
}

.report-entity__meta {
  display: block;
  margin-top: 2px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 400;
  color: var(--k-color-muted);
}

/* A product named on a row is a way to its own page, in the ink around it:
   the browser's link blue is not a colour in the system. */
a.report-entity,
.report-entity a {
  color: inherit;
  text-decoration: underline;
  text-decoration-color: var(--k-color-line);
  text-underline-offset: 3px;
}

a.report-entity:hover,
.report-entity a:hover {
  text-decoration-color: currentColor;
}

/* A product beside its picture. The picture is a square the height of the
   two lines beside it, smaller in the compact group and alert tables; a
   product without one keeps the square, dashed, so the names line up. */
.report-entity-row {
  --report-thumb: 40px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.report-table--group .report-entity-row {
  --report-thumb: 32px;
}

.report-entity-row__text {
  min-width: 0;
}

.report-entity__thumb {
  flex-shrink: 0;
  display: block;
  width: var(--report-thumb);
  height: var(--report-thumb);
  object-fit: cover;
  border: 1px solid var(--k-color-line);
  border-radius: 6px;
  background: var(--k-color-line);
}

.report-entity__thumb--none {
  background: none;
  border-style: dashed;
}

.report-products__head {
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .report-groups {
    grid-template-columns: 1fr;
  }

  .report-rule {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .report-controls {
    justify-content: flex-start;
  }
}

/* An alert's products sit under its rule, inside the rule's own column. */
.report-rule__rows {
  padding: 4px 0 0;
}

.report-rule__rows .report-table tbody th,
.report-rule__rows .report-table tbody td {
  padding-top: 8px;
  padding-bottom: 8px;
}
