:root {
  --bg: #0d1117;
  --panel: #161b22;
  --panel-2: #1c2330;
  --border: #2a3441;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --green: #2ea043;
  --amber: #d29922;
  --red: #f85149;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.35);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #182338 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 28px;
  border-bottom: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.7);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 14px; }
.logo {
  font-size: 28px;
  color: var(--accent);
  filter: drop-shadow(0 0 8px rgba(79, 140, 255, 0.5));
}
.topbar h1 { font-size: 20px; margin: 0; letter-spacing: 0.2px; }
.tagline { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }

.btn {
  border: 1px solid transparent;
  background: linear-gradient(180deg, var(--accent), #3f77e0);
  color: white;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn-ghost {
  background: transparent;
  border-color: var(--border);
  color: var(--text);
  font-weight: 500;
}
.btn-ghost:hover { background: var(--panel-2); }

.btn-accent {
  background: linear-gradient(180deg, #12b981, #0d9668);
}
.btn:disabled { opacity: 0.6; cursor: progress; filter: none; }

.live-dot {
  color: #12b981;
  font-size: 0.85rem;
  font-weight: 600;
  animation: livepulse 2s ease-in-out infinite;
}
@keyframes livepulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }

.pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}
.pill-muted { color: var(--muted); }
.pill-ok { color: var(--green); border-color: rgba(46, 160, 67, 0.4); }
.pill-err { color: var(--red); border-color: rgba(248, 81, 73, 0.4); }

.summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  padding: 22px 28px 6px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  min-height: 96px;
}
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; }
.stat-value { display: block; font-size: 34px; font-weight: 700; margin-top: 8px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip {
  font-size: 12px;
  font-family: inherit;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  color: var(--text);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.chip:hover { border-color: var(--accent); }
.chip-active {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 18%, var(--panel-2));
}
.chip b { color: var(--accent); margin-left: 4px; }

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 28px;
  align-items: center;
}
.filters input, .filters select {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  outline: none;
}
.filters input:focus, .filters select:focus { border-color: var(--accent); }
.filters .grow { flex: 1 1 260px; }
.filters .state { width: 70px; text-transform: uppercase; }
.filters .zip { width: 92px; }
.filters .money { width: 92px; }

.results-meta {
  display: flex;
  justify-content: space-between;
  padding: 4px 28px 12px;
  font-size: 14px;
}
.results-meta-left { display: flex; align-items: center; gap: 14px; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--muted);
  user-select: none;
  font-size: 13px;
}
.toggle input { accent-color: var(--accent); cursor: pointer; margin: 0; }
.toggle:hover { color: var(--text); }
.muted { color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
  padding: 0 28px 28px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.card:hover { transform: translateY(-3px); border-color: var(--accent); box-shadow: var(--shadow); }
.card-img {
  aspect-ratio: 3 / 2;
  background: var(--panel-2) center/cover no-repeat;
  position: relative;
}
.card-img.has-img { cursor: zoom-in; }
.card-img:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.card-zoom {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 6px;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  opacity: 0;
  transition: opacity 0.15s ease;
}
.card-img.has-img:hover .card-zoom,
.card-img.has-img:focus-visible .card-zoom { opacity: 1; }
.badge {
  position: absolute;
  top: 10px;
  left: 10px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 4px 9px;
  border-radius: 6px;
  color: white;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}
.badge.hibid { background: linear-gradient(180deg, #4f8cff, #3f77e0); }
.badge.govdeals { background: linear-gradient(180deg, #2ea043, #248636); }
.badge.proxibid { background: linear-gradient(180deg, #f0803c, #d85f1e); }
.badge.bidable { background: linear-gradient(180deg, #7c5cff, #5a3fe0); }
.badge.bidsquare { background: linear-gradient(180deg, #14b8a6, #0d9488); }
.badge.bstock { background: linear-gradient(180deg, #e0483c, #c0392b); }
.badge.liquidation { background: linear-gradient(180deg, #f5b301, #d99a00); }
.countdown {
  position: absolute;
  bottom: 10px;
  right: 10px;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.68);
}
.countdown.urgent { color: #fff; background: rgba(248, 81, 73, 0.85); }
.countdown.soon { color: #fff; background: rgba(210, 153, 34, 0.85); }

.card-body { padding: 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.card-title { font-size: 15px; font-weight: 600; line-height: 1.35; margin: 0; }
.card-seller { font-size: 12px; font-weight: 600; color: var(--text); opacity: 0.9; }
.card-seller .via { color: var(--muted); font-weight: 500; }
.card-row { display: flex; justify-content: space-between; align-items: baseline; }
.bid { font-size: 20px; font-weight: 700; border-radius: 6px; }
.bid small { font-size: 12px; color: var(--muted); font-weight: 500; }
/* Pulse a bid when its price changes on a live refresh (no full reload). */
.bid.flash { animation: bid-flash 1.1s ease-out; }
@keyframes bid-flash {
  0% { background: color-mix(in srgb, var(--green) 55%, transparent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--green) 35%, transparent); }
  100% { background: transparent; box-shadow: 0 0 0 4px transparent; }
}
@media (prefers-reduced-motion: reduce) { .bid.flash { animation: none; } }
.card-msrp { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: -2px; }
.card-msrp .msrp-pct { color: var(--green); }
.card-perunit { font-size: 12px; font-weight: 600; color: var(--muted); margin-top: -2px; }
.card-perunit .perunit-val { color: var(--green); }
.card-meta { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.reserve { font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 5px; }
.reserve.reserve_met { color: var(--green); background: rgba(46, 160, 67, 0.14); }
.reserve.reserve_not_met { color: var(--amber); background: rgba(210, 153, 34, 0.14); }
.reserve.no_reserve { color: var(--accent); background: rgba(79, 140, 255, 0.14); }
.reserve.unknown { color: var(--muted); background: var(--panel-2); }
.card-cats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.cat-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--accent);
  background: rgba(79, 140, 255, 0.12);
  border: 1px solid rgba(79, 140, 255, 0.25);
  cursor: pointer;
}
.cat-chip:hover { background: rgba(79, 140, 255, 0.22); }
.card-footer { margin-top: auto; }
.card-link {
  display: block;
  text-align: center;
  padding: 8px;
  border-top: 1px solid var(--border);
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.card-link:hover { background: var(--panel-2); }

.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 0 28px 40px;
}

.empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty h3 { color: var(--text); margin-bottom: 8px; }

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  font-size: 14px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.error { border-color: var(--red); }

@media (max-width: 820px) {
  .summary { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .summary { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; gap: 12px; align-items: flex-start; }
}

/* --- gallery lightbox ---------------------------------------------------- */
body.modal-open { overflow: hidden; }

.gallery {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery[hidden] { display: none; }
.gallery-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.86);
  backdrop-filter: blur(6px);
}
.gallery-panel {
  position: relative;
  z-index: 1;
  width: min(1100px, 94vw);
  height: min(88vh, 900px);
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 1fr auto;
  gap: 12px;
  padding: 14px;
}
.gallery-close {
  position: absolute;
  top: -6px;
  right: -6px;
  z-index: 3;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.08s ease;
}
.gallery-close:hover { background: var(--panel-2); }
.gallery-stage {
  grid-row: 1;
  grid-column: 1;
  margin: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}
#gallery-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.gallery-caption {
  position: absolute;
  bottom: 10px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  background: rgba(0, 0, 0, 0.6);
  padding: 5px 12px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}
.gallery-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(22, 27, 34, 0.8);
  color: var(--text);
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s ease;
}
.gallery-nav:hover { background: var(--panel-2); }
.gallery-nav.prev { left: 4px; }
.gallery-nav.next { right: 4px; }
.gallery-nav[hidden] { display: none; }
.gallery-thumbs {
  grid-row: 2;
  grid-column: 1;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px 2px;
  scrollbar-width: thin;
}
.gallery-thumbs[hidden] { display: none; }
.gallery-thumb {
  flex: 0 0 auto;
  width: 74px;
  height: 56px;
  border-radius: 6px;
  border: 2px solid transparent;
  background: var(--panel-2) center/cover no-repeat;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.15s ease, border-color 0.15s ease;
}
.gallery-thumb:hover { opacity: 1; }
.gallery-thumb.active { opacity: 1; border-color: var(--accent); }

@media (max-width: 640px) {
  .gallery-panel { width: 96vw; height: 92vh; padding: 8px; }
  .gallery-thumb { width: 60px; height: 46px; }
  .gallery-nav { width: 40px; height: 40px; font-size: 24px; }
}

/* --- lot detail modal ---------------------------------------------------- */
.lot-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
}
.lot-modal[hidden] { display: none; }
.lot-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 12, 0.82);
  backdrop-filter: blur(6px);
}
.lot-modal-panel {
  position: relative;
  z-index: 1;
  width: min(960px, 94vw);
  max-height: 90vh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.lot-modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 3;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(13, 17, 23, 0.7);
  color: var(--text);
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.lot-modal-close:hover { background: var(--panel-2); }
.lot-modal-media {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--bg);
}
.lot-modal-img {
  flex: 1;
  min-height: 260px;
  background: var(--panel-2) center/cover no-repeat;
  cursor: zoom-in;
}
.lot-modal-img:not(.has-img) {
  cursor: default;
  background: var(--panel-2);
}
.lot-modal-photos {
  margin: 10px;
  font-size: 13px;
}
.lot-modal-body {
  padding: 22px 22px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.lot-modal-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.lot-modal-seller { color: var(--muted); font-size: 13px; }
.lot-modal-title {
  margin: 0;
  font-size: 20px;
  line-height: 1.3;
}
.lot-modal-bidrow {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.lot-modal-bidrow .countdown {
  position: static;
  flex: 0 0 auto;
}
.lot-modal-bid { display: flex; flex-direction: column; gap: 2px; }.lot-modal-bid-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.lot-modal-bid-amt { font-size: 22px; font-weight: 700; }
.lot-modal-bid-count { font-size: 12px; color: var(--muted); }
.lot-modal-facts {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px 18px;
}
.lot-fact dt {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
}
.lot-fact dd { margin: 2px 0 0; font-size: 14px; }
.lot-modal-cats { display: flex; flex-wrap: wrap; gap: 6px; }
.lot-modal-desc {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  max-height: 160px;
  overflow-y: auto;
  white-space: pre-line;
}
.lot-modal-desc[hidden] { display: none; }
.lot-modal-actions { margin-top: auto; }
.lot-modal-bidbtn {
  display: block;
  text-align: center;
  text-decoration: none;
  font-size: 15px;
  padding: 12px;
}
.lot-modal-note {
  margin: 0;
  text-align: center;
  font-size: 11px;
  color: var(--muted);
}

@media (max-width: 720px) {
  .lot-modal-panel {
    grid-template-columns: 1fr;
    max-height: 92vh;
  }
  .lot-modal-img { min-height: 200px; }
}

/* ---- B-Stock Alerts page ------------------------------------------------ */
.alerts-wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.alert-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.panel-title { margin: 0 0 6px; font-size: 20px; }
.panel-sub { margin: 0 0 18px; color: var(--muted); font-size: 14px; line-height: 1.5; }

.auth-tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.auth-tab {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 9px 12px;
  border-radius: 9px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.auth-tab.is-active { color: var(--text); border-color: var(--accent); }

.alert-form { display: flex; flex-direction: column; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.field input {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
}
.field input:focus { outline: none; border-color: var(--accent); }

.toggle-row { display: flex; align-items: center; gap: 10px; font-size: 15px; cursor: pointer; }
.toggle-row input { width: 18px; height: 18px; accent-color: var(--accent); }

.retailer-rules { display: flex; flex-direction: column; gap: 14px; }
.retailer-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--panel-2);
  padding: 14px 16px;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.retailer-card legend {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  padding: 0 6px;
}

.badge-fixed {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 9999px;
  background: #ecfdf5;
  color: #047857;
  vertical-align: middle;
}
.interval-row { display: flex; align-items: center; gap: 8px; }
.interval-row input {
  width: 72px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  color: var(--text);
  padding: 10px 12px;
  font-size: 15px;
  font-family: inherit;
}
.interval-row input:focus { outline: none; border-color: var(--accent); }
.interval-unit { font-size: 13px; color: var(--muted); }
.interval-help { font-size: 12px; color: var(--muted); }

.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.form-error, .form-msg { margin: 6px 0 0; font-size: 13px; }
.form-error, .form-msg.err { color: var(--red); }
.form-msg.ok { color: var(--green); }

.preview { margin-top: 22px; border-top: 1px solid var(--border); padding-top: 16px; }
.preview-title { font-size: 15px; margin: 0 0 12px; }
.preview-list { display: flex; flex-direction: column; gap: 12px; }
.preview-item {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}
.preview-link { color: var(--accent); font-weight: 600; text-decoration: none; font-size: 15px; }
.preview-link:hover { text-decoration: underline; }
.preview-meta { margin-top: 6px; font-size: 13px; color: var(--text); }
.preview-sub { margin-top: 4px; font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); }

/* Push notification card on the alerts page */
.push-card {
  margin-top: 20px;
  padding: 18px;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  background: rgba(37, 99, 235, 0.04);
}
.push-card .panel-title { margin-top: 0; }
