:root {
  --bg: #0c0e12;
  --panel: #14181f;
  --panel-2: #1a2028;
  --border: #262d38;
  --text: #e8edf4;
  --text-dim: #8b96a5;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.12);
  --ok: #34d399;
  --warn: #fbbf24;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand h1 {
  margin: 0;
  font-size: 20px;
}

.brand-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
}

.topbar-right {
  display: flex;
  gap: 8px;
}

.token-input,
.search {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 12px;
  font-size: 14px;
}

.token-input {
  width: 200px;
}

.btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 8px 14px;
  font-size: 14px;
  cursor: pointer;
}

.btn:hover {
  border-color: var(--accent);
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 22px 60px;
}

.devices-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-dim);
}

.devices-bar select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 7px 10px;
  font-size: 14px;
}

.spacer {
  flex: 1;
}

.btn-small {
  padding: 6px 10px;
  font-size: 13px;
}

.btn-danger {
  background: rgba(248, 113, 113, 0.08);
  border-color: var(--err);
  color: var(--err);
}

.qr-panel {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 12px 0;
}

.qr-panel h2 {
  margin: 0 0 4px;
  font-size: 15px;
}

.qr-panel img {
  width: 190px;
  height: 190px;
  image-rendering: pixelated;
  background: #fff;
  padding: 6px;
  border-radius: 8px;
}

.panel-note {
  padding: 16px;
}

.panel-note h2 {
  margin: 0 0 4px;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.panel-note p {
  margin: 0;
  line-height: 1.5;
}

.dim {
  color: var(--text-dim);
  font-size: 13px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 16px 0;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
}

.card .num {
  font-size: 26px;
  font-weight: 700;
}

.card .lbl {
  font-size: 12px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
}

.tab {
  background: none;
  border: none;
  color: var(--text-dim);
  padding: 12px 18px;
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
}

.search {
  flex: 1;
  max-width: 360px;
}

.table-scroll {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th {
  text-align: left;
  color: var(--text-dim);
  font-weight: 600;
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  position: sticky;
  top: 0;
  background: var(--panel);
}

td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tr:hover td {
  background: var(--panel-2);
}

.tag {
  display: inline-block;
  font-size: 11px;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
}

.cell-main {
  font-weight: 600;
}

.cell-dim {
  color: var(--text-dim);
}

.body-cell {
  max-width: 420px;
  white-space: pre-wrap;
  word-break: break-word;
}

.load-more {
  margin: 14px;
}

.hidden {
  display: none;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  padding: 14px;
}

.gallery-tile {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  position: relative;
}

.gallery-tile img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  display: block;
}

.gallery-tile .gallery-no-thumb {
  background: var(--panel-2);
}

.gallery-video {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: var(--accent);
  padding: 8px;
  text-align: center;
  word-break: break-all;
}

.gallery-caption {
  font-size: 11px;
  color: var(--text-dim);
  padding: 6px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 10, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.lightbox-content {
  max-width: 95vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lightbox-content img,
.lightbox-content video {
  max-width: 95vw;
  max-height: 80vh;
  border-radius: 8px;
}

.lightbox-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
}

.badge-err {
  color: var(--warn);
  font-size: 13px;
}
