:root {
  --bg-1: #06111a;
  --bg-2: #0a1c2b;
  --surface: rgba(13, 33, 49, 0.94);
  --surface-soft: rgba(255, 255, 255, 0.045);
  --line: rgba(173, 213, 235, 0.16);
  --line-strong: rgba(173, 213, 235, 0.28);
  --ink: #f4fbff;
  --muted: #9bb7c8;
  --accent: #26a9ff;
  --accent-strong: #0584e6;
  --ok: #39dba5;
  --warn: #ffbf3f;
  --danger: #ff6684;
  --purple: #9b82ff;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: "Space Grotesk", sans-serif;
  background-color: #06111a;
  background-image:
    radial-gradient(900px 560px at 75% -10%, rgba(30, 149, 211, 0.17), transparent 66%),
    radial-gradient(760px 520px at 0 100%, rgba(31, 126, 119, 0.12), transparent 65%),
    linear-gradient(145deg, var(--bg-1), var(--bg-2));
  background-attachment: fixed;
}

button, input, select { font: inherit; }
button, a, input, select { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(38, 169, 255, 0.3);
  outline-offset: 2px;
}

.hidden { display: none !important; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 74px;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px clamp(18px, 3vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(4, 16, 26, 0.9);
  backdrop-filter: blur(22px);
}

.brand img { display: block; width: 166px; height: auto; }
.topbar-copy { min-width: 0; flex: 1; }
.topbar-copy span, .topbar-copy strong { display: block; }
.topbar-copy span { color: var(--muted); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; }
.topbar-copy strong { overflow: hidden; margin-top: 2px; text-overflow: ellipsis; white-space: nowrap; font-size: 0.95rem; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.viewer-chip { max-width: 190px; overflow: hidden; padding: 8px 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; text-overflow: ellipsis; white-space: nowrap; font-size: 0.75rem; }

.button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 9px 14px;
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-weight: 700;
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: default; opacity: 0.42; transform: none; }
.button-primary { color: white; background: linear-gradient(135deg, var(--accent), var(--accent-strong)); }
.button-secondary { background: rgba(255, 255, 255, 0.07); border-color: var(--line); }
.button-ghost { color: var(--muted); background: rgba(255, 255, 255, 0.035); border-color: var(--line); }

.page-shell { width: min(1900px, 100%); margin: 0 auto; padding: clamp(22px, 3vw, 42px); }
.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  margin-bottom: 18px;
}
.eyebrow { margin: 0 0 8px; color: var(--ok); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
h1 { margin: 0; font-family: "Bebas Neue", sans-serif; font-size: clamp(2.3rem, 5vw, 4.5rem); font-weight: 400; line-height: 0.95; letter-spacing: 0.02em; }
.hero-copy { max-width: 760px; margin: 12px 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.55; }
.summary { display: grid; grid-template-columns: repeat(3, minmax(100px, 1fr)); gap: 9px; }
.summary div { min-width: 108px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-soft); }
.summary strong, .summary span { display: block; }
.summary strong { color: var(--accent); font-size: 1.3rem; }
.summary span { margin-top: 2px; color: var(--muted); font-size: 0.67rem; text-transform: uppercase; letter-spacing: 0.05em; }

.loading-card, .error-card, .records-card {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}
.loading-card { margin-bottom: 14px; padding: 15px 18px; }
.loading-copy { display: flex; align-items: center; gap: 12px; }
.loading-copy strong, .loading-copy span { display: block; }
.loading-copy strong { font-size: 0.86rem; }
.loading-copy span { margin-top: 3px; color: var(--muted); font-size: 0.72rem; }
.spinner { width: 22px; height: 22px; flex: 0 0 auto; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-track { height: 4px; margin-top: 13px; overflow: hidden; border-radius: 99px; background: rgba(255,255,255,0.06); }
.progress-track span { display: block; width: 2%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--ok)); transition: width 0.2s ease; }
.error-card { display: grid; gap: 5px; margin-bottom: 14px; padding: 16px 18px; border-color: rgba(255, 102, 132, 0.4); }
.error-card strong { color: var(--danger); }
.error-card span { color: var(--muted); font-size: 0.84rem; }
.error-card a { color: var(--accent); font-size: 0.8rem; }

.records-card { overflow: hidden; }
.filters { display: grid; grid-template-columns: minmax(280px, 2fr) repeat(3, minmax(170px, 1fr)) auto; gap: 11px; align-items: end; padding: 17px; border-bottom: 1px solid var(--line); }
.filter-field span { display: block; margin: 0 0 6px 2px; color: var(--muted); font-size: 0.68rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.055em; }
input, select { width: 100%; min-height: 44px; padding: 10px 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 11px; background: rgba(4, 14, 23, 0.62); }
select option { color: var(--ink); background: #0d2131; }
.clear-button { min-height: 44px; }
.records-meta { display: flex; justify-content: space-between; gap: 16px; padding: 11px 18px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: 0.73rem; }
.records-meta p { margin: 0; }

.table-wrap { overflow: auto; }
table { width: 100%; min-width: 1260px; border-collapse: collapse; }
th, td { padding: 13px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { position: sticky; top: 0; z-index: 2; padding: 0; background: #0a1c2b; }
th button { width: 100%; min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 11px 15px; color: var(--muted); border: 0; background: transparent; cursor: pointer; font-size: 0.74rem; font-weight: 700; text-align: left; }
th[aria-sort="ascending"] button, th[aria-sort="descending"] button { color: var(--accent); background: rgba(38, 169, 255, 0.07); }
td { font-size: 0.78rem; line-height: 1.42; }
td strong { font-size: 0.82rem; }
.subtext { display: block; margin-top: 3px; color: var(--muted); font-size: 0.7rem; }
.detail-cell { min-width: 290px; color: var(--muted); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 9px; border-radius: 999px; font-size: 0.68rem; font-weight: 700; white-space: nowrap; }
.status-pill::before { width: 6px; height: 6px; content: ""; border-radius: 50%; background: currentColor; }
.status-pill.ok { color: var(--ok); background: rgba(57, 219, 165, 0.12); }
.status-pill.warn { color: var(--warn); background: rgba(255, 191, 63, 0.12); }
.status-pill.bad { color: var(--danger); background: rgba(255, 102, 132, 0.12); }
.status-pill.muted { color: var(--muted); background: rgba(155, 183, 200, 0.12); }
.seller-name { color: #c8bbff; font-weight: 700; }
.empty-cell { height: 220px; color: var(--muted); text-align: center; vertical-align: middle; }

.table-footer { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 17px; }
.table-footer label { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 0.72rem; }
.table-footer select { width: auto; min-height: 38px; padding: 7px 28px 7px 9px; }
.pager { display: flex; align-items: center; gap: 10px; }
.pager span { min-width: 110px; color: var(--muted); font-size: 0.72rem; text-align: center; }

@media (max-width: 1180px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-search { grid-column: 1 / -1; }
  .clear-button { width: 100%; }
}

@media (max-width: 800px) {
  .topbar { flex-wrap: wrap; }
  .brand img { width: 145px; }
  .topbar-copy { order: 3; flex-basis: 100%; }
  .viewer-chip { display: none; }
  .top-actions { margin-left: auto; }
  .top-actions .button { min-height: 36px; padding: 7px 10px; font-size: 0.7rem; }
  .page-shell { padding: 20px 14px 40px; }
  .hero { display: block; }
  .summary { margin-top: 18px; }
  .summary div { min-width: 0; }
  .filters { grid-template-columns: 1fr; }
  .filter-search { grid-column: auto; }
  .records-meta { display: block; }
  .records-meta p + p { margin-top: 4px; }
  .table-footer { align-items: stretch; flex-direction: column; }
  .pager { justify-content: space-between; }
}

@media (max-width: 480px) {
  .top-actions .button-secondary { display: none; }
  .summary { gap: 6px; }
  .summary div { padding: 10px 8px; }
  .summary strong { font-size: 1.05rem; }
  .summary span { font-size: 0.58rem; }
}
