:root {
  --bg: var(--tg-theme-bg-color, #0e1217);
  --fg: var(--tg-theme-text-color, #e7e9ec);
  --hint: var(--tg-theme-hint-color, #8a93a0);
  --link: var(--tg-theme-link-color, #6cb1ff);
  --button: var(--tg-theme-button-color, #1f8cff);
  --button-fg: var(--tg-theme-button-text-color, #ffffff);
  --section: var(--tg-theme-secondary-bg-color, #1a1f27);
}
*, *::before, *::after { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--fg);
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}
header {
  padding: 14px 16px 8px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 2;
}
header h1 { margin: 0; font-size: 17px; font-weight: 600; }
.status { color: var(--hint); font-size: 12px; margin-top: 4px; min-height: 14px; }
#launcher {
  display: grid;
  gap: 12px;
  padding: 12px 16px;
}
.tile {
  background: var(--section);
  color: var(--fg);
  border: 0;
  border-radius: 12px;
  padding: 18px 16px;
  text-align: left;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
}
.tile:disabled { opacity: 0.55; cursor: not-allowed; }
.tile em { color: var(--hint); font-style: normal; font-size: 13px; margin-left: 6px; }

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.toolbar button {
  background: transparent;
  color: var(--link);
  border: 0;
  font-size: 15px;
  cursor: pointer;
  padding: 4px 8px;
}
#grid-meta { color: var(--hint); font-size: 12px; }
#table-wrap { padding: 4px 0 24px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
}
th {
  position: sticky;
  top: 0;
  background: var(--section);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hint);
  cursor: pointer;
  user-select: none;
}
th[aria-sort=ascending]::after { content: ' ▲'; }
th[aria-sort=descending]::after { content: ' ▼'; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.pos { color: #4ade80; font-weight: 600; }
td.neg { color: #ff8080; font-weight: 600; }
.empty { color: var(--hint); padding: 20px 16px; text-align: center; }
.error { color: #ff6b6b; padding: 12px 16px; }
