:root {
  color-scheme: dark;
  --bg: #0b0d10;
  --panel: #11151b;
  --text: #e6e9ef;
  --muted: #9aa4b2;
  --border: #222a35;
  --link: #7aa2f7;
  --good: rgba(46, 204, 113, 0.18);
  --good-strong: rgba(46, 204, 113, 0.28);
  --warn: rgba(255, 193, 7, 0.16);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
  font-size: 12px;
  line-height: 1.25;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  display: grid;
  grid-template-columns: 280px 1fr;
  height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--border);
  padding: 10px;
  overflow: auto;
}

.main {
  overflow: hidden;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  margin-bottom: 10px;
}

.title {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
}

.panel-title {
  font-weight: 700;
  margin-bottom: 6px;
}

.muted {
  color: var(--muted);
}

.radio, .check {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 6px 0;
  user-select: none;
}

.list {
  display: grid;
  gap: 6px;
}

.input {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #0e1218;
  color: var(--text);
  outline: none;
}

.input::placeholder {
  color: var(--muted);
}

.table-wrap {
  height: 100vh;
  overflow: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  /* Prevent columns from being crushed on smaller viewports.
     Use horizontal scroll in .table-wrap instead of wrapping every word. */
  min-width: 1100px;
}

/* Keep columns stable; let Link take remaining width and wrap. */
.table col.col-pricekg { width: 90px; }
.table col.col-total { width: 92px; }
.table col.col-capacity { width: 86px; }
.table col.col-material { width: 78px; }
.table col.col-diameter { width: 78px; }
.table col.col-brand { width: 120px; }
.table col.col-store { width: 110px; }
.table col.col-color { width: 110px; }
.table col.col-link { width: 360px; }

.table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #0e1218;
  border-bottom: 1px solid var(--border);
}

.sortable {
  cursor: pointer;
}

.sorted {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.table th, .table td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Show full product names in the Link column (wrap instead of forcing wide columns). */
.table td.link {
  white-space: normal;
  text-overflow: clip;
  overflow-wrap: break-word;
  word-break: normal;
}

/* Show full product names in the Link column */
.table td.link {
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.table td.link a.link-full {
  white-space: normal;
}

.table th.num, .table td.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.row-top5 {
  background: rgba(148, 163, 184, 0.08);
}

.row-unicorn {
  background: var(--good-strong);
}

.tag {
  display: inline-block;
  padding: 1px 6px;
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { height: auto; border-right: none; border-bottom: 1px solid var(--border); }
  .table-wrap { height: calc(100vh - 380px); }
}
