:root {
  color-scheme: dark;
  --bg: #090e18;
  --panel: #101826;
  --panel-2: #131e2f;
  --line: #253248;
  --text: #edf3fb;
  --muted: #91a0b7;
  --accent: #7cc7ff;
  --accent-soft: rgba(124, 199, 255, .10);
  --radius: 14px;
  --focus-ring: rgba(124,199,255,.09);
  --hero-stats-bg: rgba(16,24,38,.72);
  --ghost-hover-border: #3a4b66;
  --table-card-bg: rgba(16,24,38,.8);
  --thead-bg: #121c2c;
  --th-text: #b9c8da;
  --td-border: rgba(37,50,72,.72);
  --td-highlight: #b4ddff;
  --badge-border: #30415d;
  --badge-bg: #142136;
  --body-grad: radial-gradient(900px 420px at 10% -10%, rgba(54, 116, 181, .18), transparent 60%);
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f8fafc;
  --panel: #ffffff;
  --panel-2: #f1f5f9;
  --line: #cbd5e1;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0284c7;
  --accent-soft: rgba(2, 132, 199, 0.1);
  --focus-ring: rgba(2, 132, 199, 0.15);
  --hero-stats-bg: rgba(255, 255, 255, 0.8);
  --ghost-hover-border: #94a3b8;
  --table-card-bg: rgba(255, 255, 255, 0.9);
  --thead-bg: #f8fafc;
  --th-text: #475569;
  --td-border: #e2e8f0;
  --td-highlight: #0369a1;
  --badge-border: #cbd5e1;
  --badge-bg: #f1f5f9;
  --body-grad: radial-gradient(900px 420px at 10% -10%, rgba(186, 230, 253, 0.4), transparent 60%);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  background:
    var(--body-grad),
    var(--bg);
  color: var(--text);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
.shell { width: min(1500px, calc(100% - 32px)); margin: 0 auto; padding: 40px 0 28px; }
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: end; margin-bottom: 26px; }
.eyebrow { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1 { margin: 5px 0 4px; font-size: clamp(28px, 4vw, 44px); line-height: 1.05; letter-spacing: -.035em; }
.muted, footer { color: var(--muted); }
.hero-stats { display: flex; gap: 10px; }
.hero-stats div { min-width: 104px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--hero-stats-bg); }
.hero-stats strong { display: block; font-size: 21px; }
.hero-stats span { color: var(--muted); font-size: 12px; }
.toolbar { display: grid; gap: 12px; margin-bottom: 14px; }
.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap svg { position: absolute; left: 14px; width: 18px; fill: none; stroke: var(--muted); stroke-width: 1.8; }
.search-wrap input { width: 100%; height: 46px; padding: 0 48px 0 42px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; outline: none; }
.search-wrap input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
kbd { border: 1px solid var(--line); background: var(--panel-2); color: var(--muted); border-radius: 6px; padding: 1px 6px; font-size: 11px; }
.search-wrap kbd { position: absolute; right: 13px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
select, .ghost { min-height: 38px; padding: 0 12px; color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; outline: none; }
select { cursor: pointer; }
.ghost { cursor: pointer; color: var(--muted); }
.ghost:hover { color: var(--text); border-color: var(--ghost-hover-border); }
.table-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--table-card-bg); box-shadow: 0 18px 60px rgba(0,0,0,.18); }
.table-scroll { overflow: auto; max-height: calc(100vh - 275px); }
table { width: 100%; min-width: 1080px; border-collapse: collapse; }
thead { position: sticky; top: 0; z-index: 2; background: var(--thead-bg); }
th { text-align: left; color: var(--th-text); font-size: 12px; font-weight: 700; letter-spacing: .02em; cursor: pointer; user-select: none; white-space: nowrap; }
th::after { content: "↕"; margin-left: 6px; opacity: .25; }
th.active.asc::after { content: "↑"; opacity: 1; color: var(--accent); }
th.active.desc::after { content: "↓"; opacity: 1; color: var(--accent); }
th, td { padding: 11px 13px; border-bottom: 1px solid var(--td-border); }
tbody tr:hover { background: var(--accent-soft); }
td { vertical-align: top; }
td:nth-child(2) { color: var(--td-highlight); font-weight: 650; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
td:nth-child(3) { min-width: 300px; font-weight: 580; }
td:nth-child(4), td:nth-child(6), td:nth-child(7), td:nth-child(8) { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-flex; align-items: center; border: 1px solid var(--badge-border); background: var(--badge-bg); padding: 2px 8px; border-radius: 999px; font-size: 12px; }
.empty { padding: 50px 20px; text-align: center; color: var(--muted); }
footer { display: flex; justify-content: space-between; gap: 20px; padding: 12px 4px 0; font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

.dropdown-wrap { position: relative; }
.dropdown-btn {
  min-height: 38px; padding: 0 12px; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer; outline: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-width: 140px; white-space: nowrap; font: inherit;
}
.dropdown-btn:hover, .dropdown-btn:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
.dropdown-btn::after { content: "▼"; font-size: 10px; opacity: 0.6; }
.dropdown-popover {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 200px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  z-index: 100; box-shadow: 0 10px 30px rgba(0,0,0,0.3);
  max-height: 250px; display: flex; flex-direction: column;
}
.dropdown-popover[hidden] { display: none !important; }
.dropdown-actions {
  display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid var(--line);
}
.dropdown-actions button {
  flex: 1; padding: 4px; font-size: 11px; min-height: unset; border-radius: 6px; text-transform: uppercase; font-weight: 600;
}
.dropdown-list {
  overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px;
}
.dropdown-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px; cursor: pointer;
  border-radius: 6px; user-select: none;
}
.dropdown-item:hover { background: var(--panel-2); }
.dropdown-item input { cursor: pointer; accent-color: var(--accent); }
.theme-btn {
  position: absolute; top: 16px; right: 16px; z-index: 10;
  background: var(--panel); border: 1px solid var(--line); font-size: 16px;
  cursor: pointer; width: 40px; height: 40px; border-radius: 50%;
  color: var(--text); display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}
.theme-btn:hover { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus-ring); }
@media (max-width: 760px) {
  .shell { width: min(100% - 20px, 1500px); padding-top: 24px; }
  .hero { align-items: start; flex-direction: column; }
  .hero-stats { width: 100%; }
  .hero-stats div { flex: 1; }
  .filters select, .filters .dropdown-wrap { flex: 1 1 calc(50% - 8px); min-width: 140px; }
  .dropdown-btn { width: 100%; }
  .ghost { flex: 1; }
  .table-scroll { max-height: calc(100vh - 360px); }
  footer { flex-direction: column; gap: 4px; }
}
