*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0f14;
  --bg2: #141720;
  --bg3: #1c1f2e;
  --bg4: #242838;
  --border: #2a2e3f;
  --text: #e2e4f0;
  --text2: #8b90a8;
  --text3: #5a5f75;
  --accent: #6c8aff;
  --accent2: #4a6bff;
  --green: #3dd68c;
  --red: #f06292;
  --yellow: #ffca62;
  --orange: #ff8c5a;
  --purple: #b48eff;
  --sidebar-w: 240px;
  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent2); text-decoration: underline; }

#app { display: flex; min-height: 100vh; }

#sidebar {
  width: var(--sidebar-w);
  background: var(--bg2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px;
  border-bottom: 1px solid var(--border);
}
.logo-icon { font-size: 22px; }
.sidebar-title { font-weight: 700; font-size: 14px; color: var(--text); letter-spacing: 0.01em; }

.nav-links { list-style: none; padding: 12px 8px; flex: 1; }
.nav-links li { margin-bottom: 2px; }
.nav-link {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all 0.15s;
}
.nav-link:hover { background: var(--bg3); color: var(--text); }
.nav-link.active { background: var(--bg4); color: var(--accent); }
.nav-icon { font-size: 15px; width: 18px; text-align: center; }

.sidebar-footer {
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  display: flex; align-items: center; gap: 8px;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text3);
  transition: background 0.3s;
}
.status-dot.ok { background: var(--green); box-shadow: 0 0 6px rgba(61,214,140,0.6); }
.status-dot.err { background: var(--red); }
.status-label { font-size: 12px; color: var(--text3); }

#main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 28px 32px;
  min-height: 100vh;
}

.view-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
  flex-wrap: wrap;
}
.view-header h1 { font-size: 22px; font-weight: 700; margin-bottom: 4px; }
.subtitle { color: var(--text2); font-size: 13px; }

.header-stats {
  display: flex; gap: 6px; flex-wrap: wrap;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text2);
}
.pill-green { color: var(--green); border-color: rgba(61,214,140,0.3); }
.pill-yellow { color: var(--yellow); border-color: rgba(255,202,98,0.3); }
.pill-orange { color: var(--orange); border-color: rgba(255,140,90,0.3); }
.pill-red { color: var(--red); border-color: rgba(240,98,146,0.3); }
.pill-muted { color: var(--text2); }
.pill-platform { background: var(--bg4); color: var(--text); border-color: var(--border); }

.tab-content.hidden { display: none; }

.check-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.check-card label { display: block; font-weight: 600; margin-bottom: 8px; }
.check-row { display: flex; gap: 8px; }
.check-row input {
  flex: 1;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.check-row button {
  background: var(--accent);
  color: white;
  border: none;
  padding: 8px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
}
.check-row button:hover { background: var(--accent2); }
.muted { color: var(--text2); font-size: 13px; }

.table-wrap {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--bg3);
  color: var(--text2);
  font-weight: 600;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr.row-clickable { cursor: pointer; }
.data-table tr.row-clickable:hover { background: var(--bg3); }
.data-table .name-cell { font-weight: 600; }
.data-table .name-cell .handle { color: var(--text3); font-weight: 400; font-size: 12px; margin-left: 6px; }

.status-chip {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.status-active { background: rgba(61,214,140,0.15); color: var(--green); }
.status-restricted { background: rgba(255,202,98,0.15); color: var(--yellow); }
.status-paused { background: rgba(255,140,90,0.15); color: var(--orange); }
.status-closed { background: rgba(240,98,146,0.15); color: var(--red); }
.status-ai_banned { background: rgba(240,98,146,0.18); color: var(--red); }
.status-unknown { background: var(--bg3); color: var(--text2); }

.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}
.card:hover { border-color: var(--accent); transform: translateY(-1px); }
.card-title { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.card-meta { display: flex; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.card-when { color: var(--text3); font-size: 12px; }
.card-change { color: var(--text2); font-size: 13px; }

.filters {
  display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap;
}
.filters input, .filters select {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 7px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.filters input { flex: 1; min-width: 200px; }

.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(520px, 95vw);
  background: var(--bg2);
  border-left: 1px solid var(--border);
  z-index: 200;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.18s;
}
.drawer.hidden { transform: translateX(110%); pointer-events: none; }
.drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.drawer-header h2 { font-size: 17px; font-weight: 700; }
#drawer-close {
  background: transparent; border: none; color: var(--text2);
  font-size: 24px; cursor: pointer; padding: 0 6px;
}
#drawer-close:hover { color: var(--text); }
.drawer-body { padding: 18px; overflow-y: auto; flex: 1; }
.drawer-section { margin-bottom: 18px; }
.drawer-section h3 {
  font-size: 12px; text-transform: uppercase; color: var(--text3);
  letter-spacing: 0.04em; margin-bottom: 6px;
}
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 6px 12px; font-size: 13px; }
.kv dt { color: var(--text2); }
.kv dd { color: var(--text); }
.event-timeline { list-style: none; }
.event-timeline li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
  font-size: 13px;
}
.event-timeline li:last-child { border-bottom: none; }
.event-when { color: var(--text3); font-size: 12px; margin-left: 6px; }

.embed-snippet {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text);
  overflow-x: auto;
  white-space: pre;
}
.copy-btn {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  margin-top: 6px;
}
.copy-btn:hover { background: var(--bg4); }

.empty {
  padding: 40px;
  text-align: center;
  color: var(--text3);
}

@media (max-width: 720px) {
  :root { --sidebar-w: 0px; }
  #sidebar { display: none; }
  #main-content { margin-left: 0; padding: 16px; }
  .data-table th:nth-child(4), .data-table td:nth-child(4),
  .data-table th:nth-child(5), .data-table td:nth-child(5) { display: none; }
}
