/* Model Stats -> "Agent Assignments" tab: one row per Letta agent, editable
   model + OAuth-account dropdowns, weekly-remaining progress bar.

   Scoped entirely under .win98-agents -- the vendor 98.css restyles bare
   <button>/<select>/<table> globally, which would repaint every other tab on
   this page, so this hand-rolls the same bevel technique (silver + the same
   four box-shadow inset colors) already used by .receipt-read-progress /
   .mazda-mode-track in intake_report.css, just scoped to this one table. */

.win98-agents {
  background: silver;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #dfdfdf,
    inset -2px -2px grey, inset 2px 2px #fff;
  padding: 8px;
  font-family: "Courier New", Courier, monospace;
  color: #000;
  /* Without this, a browser in OS dark mode renders <select>'s closed-box
     text using native dark-theme styling (white) even though its
     background-color is set to white below -- author `color` alone doesn't
     always win for <select> the way it does for other controls. This is
     what turned the model dropdown's text invisible. */
  color-scheme: light;
}

.win98-agents table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.win98-agents thead th {
  background: silver;
  box-shadow: inset -1px -1px #0a0a0a, inset 1px 1px #fff,
    inset -2px -2px grey, inset 2px 2px #dfdfdf;
  font-weight: normal;
  text-align: left;
  padding: 4px 8px;
  white-space: nowrap;
}

.win98-agents tbody td {
  padding: 4px 8px;
  border-bottom: 1px solid #dfdfdf;
  vertical-align: middle;
}

.win98-agents tbody tr:nth-child(even) {
  background: #f3f3f3;
}

.win98-agents .win98-tool-assignment {
  background: #fffbe6;
}

.win98-agents .win98-assignment-token {
  white-space: nowrap;
}

.win98-agents .win98-assignment-token.is-up {
  color: #006400;
}

.win98-agents .win98-assignment-token.is-down {
  color: #b00000;
  font-weight: bold;
}

.win98-agents .win98-assignment-token.is-unknown {
  color: grey;
  font-style: italic;
}

.win98-agents select,
.win98-agents select option {
  color: #000;
  background-color: #fff;
}

.win98-agents select {
  box-shadow: inset -1px -1px #fff, inset 1px 1px grey,
    inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
  border: none;
  border-radius: 0;
  padding: 2px 4px;
  min-width: 150px;
  font-family: "Courier New", Courier, monospace;
  font-size: 12px;
}

.win98-agents select:disabled {
  color: grey;
  background-color: silver;
}

.win98-agents .win98-bar-cell {
  min-width: 160px;
}

.win98-agents .win98-bar-track {
  position: relative;
  height: 16px;
  background: #fff;
  box-shadow: inset -1px -1px #fff, inset 1px 1px grey,
    inset -2px -2px #dfdfdf, inset 2px 2px #0a0a0a;
}

.win98-agents .win98-bar-fill {
  height: 100%;
  background: #4ade80;
  transition: width 0.4s ease;
}

.win98-agents .win98-bar-fill.is-low {
  background: #facc15;
}

.win98-agents .win98-bar-fill.is-critical {
  background: #ef4444;
}

/* Recalculating after a model/account switch: the real percentage can take
   a moment (a live usage-API round trip), so blink the bar rather than
   leaving the old value sitting still looking like nothing is happening. */
.win98-agents .win98-bar-fill.is-recalculating {
  animation: win98-bar-blink 0.5s step-start infinite;
}

/* A rate-limited usage probe (429 on the usage-reporting endpoint) is not a
   dead token -- distinct grey from is-critical's red so it doesn't read as
   an actual outage while a live countdown to reset shows in the label. */
.win98-agents .win98-bar-fill.is-pending {
  background: #94a3b8;
  animation: win98-bar-blink 1s step-start infinite;
}

@keyframes win98-bar-blink {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.25; }
}

.win98-agents .win98-bar-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  color: #000;
  text-shadow: 0 0 2px #fff;
}

.win98-agents .win98-dim {
  color: grey;
  font-style: italic;
}
