/* "Auto-win" autopilot UI (static/autopilot.js). Kept in its own sheet so
   sibling workstreams editing styles.css never collide with this lane. */

/* ---------- per-row toggle ---------- */
.autowin-toggle {
  display: inline-flex; align-items: center; gap: 4px;
  border: 1px solid var(--line, rgba(128, 128, 128, 0.25));
  background: transparent; border-radius: 999px;
  padding: 1px 7px; margin-left: 6px;
  font-size: 11px; line-height: 1.5; cursor: pointer;
  color: var(--muted, #8b93a7);
  filter: grayscale(1); opacity: 0.55;
  transition: opacity 0.15s ease, filter 0.15s ease, border-color 0.15s ease;
  vertical-align: middle;
}
.autowin-toggle:hover { opacity: 1; filter: none; }
.autowin-toggle.on {
  filter: none; opacity: 1;
  color: var(--accent, #5b8cff);
  border-color: color-mix(in srgb, var(--accent, #5b8cff) 55%, transparent);
  background: color-mix(in srgb, var(--accent, #5b8cff) 12%, transparent);
  animation: autowin-pulse 2.4s ease-in-out infinite;
}
.autowin-toggle.amber {
  filter: none; opacity: 1;
  color: var(--amber, #e6a23c);
  border-color: color-mix(in srgb, var(--amber, #e6a23c) 60%, transparent);
  background: color-mix(in srgb, var(--amber, #e6a23c) 14%, transparent);
}
.autowin-max { font-variant-numeric: tabular-nums; font-weight: 600; }

@keyframes autowin-pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent, #5b8cff) 35%, transparent); }
  50% { box-shadow: 0 0 0 4px transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .autowin-toggle.on { animation: none; }
}

/* Ceiling-blocked / rate-limited row: the "you're losing these leads" amber. */
tr.autowin-row-blocked td {
  background: color-mix(in srgb, var(--amber, #e6a23c) 7%, transparent);
}
tr.autowin-row-blocked td:first-child {
  box-shadow: inset 3px 0 0 var(--amber, #e6a23c);
}

/* ---------- enable popover + active list ---------- */
.autowin-pop {
  position: fixed; z-index: 1000; width: 260px;
  background: var(--surface, #12151f);
  border: 1px solid var(--line, rgba(128, 128, 128, 0.3));
  border-radius: 12px; padding: 14px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  font-size: 13px; color: var(--fg, #e8ebf2);
}
.autowin-pop__title {
  font-weight: 600; margin-bottom: 10px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.autowin-pop__label {
  display: block; font-size: 11px; color: var(--muted, #8b93a7);
  margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.04em;
}
.autowin-pop__row { display: flex; align-items: center; gap: 6px; }
.autowin-pop__dollar { color: var(--muted, #8b93a7); font-weight: 600; }
.autowin-pop__row input {
  flex: 1; min-width: 0; padding: 7px 9px; font-size: 14px;
  border: 1px solid var(--line, rgba(128, 128, 128, 0.3));
  border-radius: 8px; background: var(--bg, #0a0c12); color: inherit;
  font-variant-numeric: tabular-nums;
}
.autowin-pop__hint {
  margin-top: 8px; font-size: 11.5px; line-height: 1.45;
  color: var(--muted, #8b93a7);
}
.autowin-pop__warn {
  margin-top: 8px; font-size: 11.5px; color: var(--amber, #e6a23c);
}
.autowin-pop__actions {
  display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px;
}
.autowin-pop__status {
  font-size: 11.5px; color: var(--muted, #8b93a7); margin: -6px 0 8px;
}
.autowin-pop__off { margin-right: auto; color: var(--red, #f87171); }

/* ---------- bulk "Auto-win selected" button + modal ---------- */
/* Distinct from btn--primary (plain accent, "Max bid + 1") and btn--save
   (green, defend): the robot autopilot gets the brand accent→violet gradient
   so it reads as "the automation action", not another one-shot bid. */
.btn--autowin {
  background: linear-gradient(135deg, var(--accent, #5b8cff), #7c5cff);
  color: #fff; border-color: transparent; font-weight: 700;
  display: inline-flex; align-items: center; gap: 6px;
}
.btn--autowin:hover { filter: brightness(1.08); }
.btn--autowin:disabled { opacity: 0.55; cursor: not-allowed; }

.autowin-bulk .modal-card { max-width: 440px; gap: 14px; }
.autowin-bulk h2 { display: flex; align-items: center; gap: 8px; }
.autowin-bulk .autowin-pop__row { margin-top: 2px; }
.autowin-bulk__explain {
  margin-top: 10px; font-size: 12.5px; line-height: 1.5;
  color: var(--muted, #8b93a7);
}
.autowin-bulk__list {
  margin-top: 8px; font-size: 11.5px; line-height: 1.5;
  color: var(--faint, #6b7280); max-height: 76px; overflow: auto;
}
.autowin-bulk__scale {
  margin-top: 10px; font-size: 12.5px; line-height: 1.6;
  color: var(--amber, #e6a23c);
}
.autowin-bulk__scale input {
  width: 72px; margin-left: 8px; padding: 5px 8px; font-size: 13px;
  border: 1px solid var(--amber, #e6a23c); border-radius: 8px;
  background: var(--bg, #0a0c12); color: inherit;
  font-variant-numeric: tabular-nums; text-align: center;
}
.autowin-bulk__results { margin-top: 10px; font-size: 12px; }
.autowin-bulk__ok { color: var(--green, #3ecf8e); font-weight: 600; }
.autowin-bulk__failhead {
  margin-top: 8px; color: var(--amber, #e6a23c); font-weight: 600;
}
.autowin-bulk__fail {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 4px 0; border-top: 1px solid var(--line, rgba(128, 128, 128, 0.15));
  color: var(--muted, #8b93a7);
}
.autowin-bulk__fail span:first-child {
  font-variant-numeric: tabular-nums; flex: none;
}
.autowin-bulk__fail span:last-child {
  text-align: right; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- header chip ---------- */
.autowin-chip {
  display: inline-flex; align-items: center; gap: 5px;
  border: 1px solid color-mix(in srgb, var(--accent, #5b8cff) 45%, transparent);
  background: color-mix(in srgb, var(--accent, #5b8cff) 10%, transparent);
  color: var(--accent, #5b8cff);
  border-radius: 999px; padding: 3px 10px;
  font-size: 12px; font-weight: 600; cursor: pointer;
}
.autowin-chip.amber {
  border-color: color-mix(in srgb, var(--amber, #e6a23c) 55%, transparent);
  background: color-mix(in srgb, var(--amber, #e6a23c) 12%, transparent);
  color: var(--amber, #e6a23c);
}

/* ---------- active list ---------- */
.autowin-list { width: 380px; max-height: 60vh; overflow: auto; }
.autowin-list__row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-top: 1px solid var(--line, rgba(128, 128, 128, 0.15));
}
.autowin-list__row:first-of-type { border-top: 0; }
.autowin-list__name {
  flex: 1; min-width: 0; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-size: 12.5px;
}
.autowin-list__status {
  font-size: 11px; color: var(--muted, #8b93a7); white-space: nowrap;
}
.autowin-list__status.amber { color: var(--amber, #e6a23c); font-weight: 600; }
.autowin-list__status.good { color: var(--green, #3ecf8e); }
.autowin-list__max { font-size: 11.5px; color: var(--muted, #8b93a7); white-space: nowrap; }
