/* Request-log tab: the 12-column row grid, the click-to-expand error cell and the stacked-card fallback below the grid's minimum width. */

/* Request log */
.requests-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}
.requests-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.requests-field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 8rem;
}
.requests-field-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.requests-summary {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(9rem, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.requests-summary:empty {
  display: none;
}
.requests-summary-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  background: var(--card);
}
.requests-summary-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
  text-transform: capitalize;
}
.requests-summary-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-top: 0.125rem;
}
.requests-summary-sub {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}
.requests-list {
  display: flex;
  flex-direction: column;
  overflow-x: auto;
}
/* 12 columns: fixed widths for short/numeric cells, flexible tracks for the
   text-heavy ones (model, key, account, error) so extra width goes to the
   content that actually needs it. min-width is the point where the layout stops
   being readable — .requests-list scrolls horizontally instead of squashing
   cells, and below 1024px the media query drops to stacked cards. */
.request-row {
  display: grid;
  grid-template-columns:
    124px
    84px
    minmax(100px, 1.2fr)
    minmax(84px, 1fr)
    minmax(92px, 1.2fr)
    74px
    50px
    50px
    56px
    56px
    60px
    minmax(120px, 1.8fr);
  gap: 0.4rem;
  align-items: center;
  padding: 0.5rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  min-width: 1020px;
}
.request-row--head {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted-foreground);
  font-weight: 600;
}
.request-row > span {
  min-width: 0;
}
.request-row .req-col-time,
.request-row .req-col-ep,
.request-row .req-col-model,
.request-row .req-col-key,
.request-row .req-col-account {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.request-row .req-col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.request-row .req-col-error {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--danger, #d33);
}
.request-row .req-col-error--filled {
  cursor: pointer;
}
/* Expanded on click: wrap the full message instead of clipping it. */
.request-row .req-col-error--open {
  white-space: normal;
  overflow: visible;
  overflow-wrap: anywhere;
  line-height: 1.35;
}
.req-status {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
}
.req-status--success {
  background: color-mix(in srgb, var(--success) 18%, transparent);
  color: var(--success);
}
.req-status--danger {
  background: color-mix(in srgb, var(--destructive) 18%, transparent);
  color: var(--destructive);
}
.requests-pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  margin-top: 1rem;
}
.requests-page-info {
  font-size: 0.8125rem;
}
@media (max-width: 640px) {
  .requests-pager {
    justify-content: space-between;
  }
}
/* Below the grid's min-width the table becomes stacked cards: the header row is
   dropped and each cell carries its own label from data-label, so nothing needs
   horizontal scrolling. */
@media (max-width: 1023px) {
  .requests-list {
    overflow-x: visible;
    gap: 0.5rem;
  }
  .request-row--head {
    display: none;
  }
  .request-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.5rem 0.75rem;
    min-width: 0;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: var(--card);
    align-items: start;
  }
  .request-row > span::before {
    content: attr(data-label);
    display: block;
    font-size: 0.625rem;
    line-height: 1.4;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-weight: 600;
    color: var(--muted-foreground);
  }
  .request-row .req-col-num {
    text-align: left;
  }
  /* Cells that hold arbitrary-length text wrap instead of truncating: there is
     no header to compare against and no tooltip on touch devices. */
  .request-row .req-col-time,
  .request-row .req-col-ep,
  .request-row .req-col-model,
  .request-row .req-col-key,
  .request-row .req-col-account,
  .request-row .req-col-error {
    white-space: normal;
    overflow: visible;
    overflow-wrap: anywhere;
    line-height: 1.35;
  }
  .request-row .req-col-model,
  .request-row .req-col-error {
    grid-column: 1 / -1;
  }
  .request-row .req-col-error--filled {
    cursor: default;
  }
  /* An empty error cell would otherwise render a stray "Error" label. */
  .request-row .req-col-error:empty {
    display: none;
  }
}

