/* API-keys tab: totals, filters, the 11-column key grid, the batch bar and the key-scoped dialogs (secret reveal, detail, prompt). */

/* API keys */
.akey-totals {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.akey-totals:empty {
  display: none;
}
.akey-total-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.6rem 0.75rem;
  background: var(--card);
}
.akey-total-label {
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.akey-total-value {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--foreground);
  margin-top: 0.125rem;
  font-variant-numeric: tabular-nums;
}
.akey-total-value--danger {
  color: var(--destructive);
}
.akey-total-sub {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  margin-top: 0.125rem;
}
.akey-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.akey-filters .requests-field {
  min-width: 9rem;
}
.akey-limits-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 0 1rem;
}
.akey-notice {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--muted);
  color: var(--foreground);
  padding: 0.6rem 0.75rem;
  font-size: 0.8125rem;
  line-height: 1.45;
  margin-bottom: 1rem;
}
.akey-notice i {
  color: var(--warning);
  margin-top: 0.15rem;
}
.akey-notice--danger {
  border-color: color-mix(in srgb, var(--destructive) 45%, var(--border));
  background: color-mix(in srgb, var(--destructive) 12%, transparent);
}
.akey-notice--danger i {
  color: var(--destructive);
}
.akey-notice--paused {
  border-color: color-mix(in srgb, var(--warning) 45%, var(--border));
  background: color-mix(in srgb, var(--warning) 12%, transparent);
}
.akey-notice--paused i {
  color: var(--warning);
  margin-top: 0.1rem;
}
.akey-list {
  display: flex;
  flex-direction: column;
  overflow-x: auto;
}
.akey-empty {
  padding: 1rem 0;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
}
/* 11 columns: fixed tracks for the checkbox, badges and numeric cells, flexible
   tracks for name / key / batch so surplus width lands on the text columns.
   min-width is where the layout stops being readable: .akey-list scrolls instead
   of squashing cells, and below 1100px the media query drops to stacked cards. */
.akey-row {
  display: grid;
  grid-template-columns:
    30px
    minmax(100px, 1.3fr)
    minmax(132px, 1.1fr)
    92px
    86px
    76px
    66px
    74px
    58px
    minmax(80px, 1fr)
    174px;
  gap: 0.35rem;
  align-items: center;
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.8125rem;
  min-width: 1044px;
}
.akey-row--head {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted-foreground);
  font-weight: 600;
}
.akey-row > span {
  min-width: 0;
}
.akey-row.is-selected {
  background: var(--muted);
}
.akey-col-name,
.akey-col-key,
.akey-col-batch {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.akey-col-key {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted-foreground);
}
.akey-col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.akey-value--danger {
  color: var(--destructive);
  font-weight: 600;
}
.akey-col-actions {
  display: flex;
  gap: 0.25rem;
  justify-content: flex-end;
}
/* A filled destructive button on every row reads as a wall of red, so the
   row-level delete keeps the outline shape and carries the intent in its icon. */
.btn.akey-btn-danger {
  color: var(--destructive);
}
.btn.akey-btn-danger:hover {
  color: var(--destructive);
  border-color: color-mix(in srgb, var(--destructive) 45%, var(--border));
  background: color-mix(in srgb, var(--destructive) 10%, transparent);
}
.akey-note {
  display: block;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* The caps in force for a key, under its name. Same secondary treatment as the
   note, with the numerals tabular so stacked rows line up. */
.akey-limits {
  display: block;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
/* Credited downtime, appended to the days-left cell. That column is narrow, so
   this stays a second line rather than widening the grid. */
.akey-paused {
  display: block;
  font-size: 0.6875rem;
  color: var(--warning);
  font-variant-numeric: tabular-nums;
}
.akey-modal-subject {
  font-size: 0.8125rem;
  color: var(--muted-foreground);
  margin: 0 0 1rem;
}
.akey-secret-modal-content {
  width: min(48rem, 92vw);
}
.akey-secret-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 45vh;
  overflow-y: auto;
  margin-bottom: 1rem;
}
.akey-secret-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.5rem;
  align-items: center;
  padding: 0.4rem 0.6rem;
  border-bottom: 1px solid var(--border);
}
.akey-secret-row:last-child {
  border-bottom: none;
}
.akey-secret-name {
  display: block;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}
.akey-secret-value {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  overflow-wrap: anywhere;
  user-select: all;
}
.akey-detail-section {
  margin-bottom: 1.25rem;
}
.akey-detail-title {
  font-size: 0.8125rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
}
.akey-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 0.5rem 1rem;
}
.akey-detail-item {
  font-size: 0.8125rem;
}
.akey-detail-label {
  display: block;
  font-size: 0.6875rem;
  color: var(--muted-foreground);
}
.akey-table {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 18rem;
  overflow: auto;
  font-size: 0.75rem;
}
.akey-table-row {
  display: grid;
  gap: 0.4rem;
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--border);
  align-items: center;
}
.akey-table-row:last-child {
  border-bottom: none;
}
.akey-table-row--head {
  text-transform: uppercase;
  letter-spacing: 0.03em;
  font-weight: 600;
  color: var(--muted-foreground);
  position: sticky;
  top: 0;
  background: var(--card);
}
.akey-table--history .akey-table-row {
  grid-template-columns: 130px 72px 80px 88px minmax(80px, 1fr) 84px minmax(90px, 1.2fr);
  min-width: 700px;
}
.akey-table--daily .akey-table-row {
  grid-template-columns: 110px 80px 90px 90px;
  min-width: 380px;
}
.akey-table-row > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.akey-table-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
@media (max-width: 1099px) {
  .akey-list {
    overflow-x: visible;
    gap: 0.5rem;
  }
  .akey-row--head {
    display: none;
  }
  .akey-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;
  }
  .akey-row > span:not(.akey-col-select)::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);
  }
  .akey-col-num {
    text-align: left;
  }
  .akey-col-name,
  .akey-col-key,
  .akey-col-batch {
    white-space: normal;
    overflow: visible;
    overflow-wrap: anywhere;
    line-height: 1.35;
  }
  .akey-col-name,
  .akey-col-actions {
    grid-column: 1 / -1;
  }
  .akey-col-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
}
