:root {
  --bg: #131314;
  --panel: #1E1F20;
  --panel2: #2D2E31;
  --stroke: #444746;
  --text: #E3E3E3;
  --muted: #C4C7C5;
  --pill: #2D2E31;
  --pillActive: #4C8DF6;
  --header: #1E1F20;
  --shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  --font-family: "Google Sans Flex", "Google Sans", "Helvetica Neue", sans-serif;
}

* { box-sizing: border-box; outline: none; }

body {
  margin: 0;
  font-family: var(--font-family);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
  line-height: 1.5;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 16px;
  gap: 16px;
}

/* Topbar */
.topbar {
  flex: 0 0 60px;
  background: var(--header);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 12px; }
.brand-logo { height: 28px; width: auto; display: block; }
.brand-title { font-size: 14px; color: var(--muted); opacity: 0.8; font-weight: 400; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }

.back-link {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  padding: 6px 14px;
  border: 1px solid var(--stroke);
  border-radius: 100px;
  transition: all 0.2s;
}
.back-link:hover { background: var(--panel2); color: var(--text); }

.icon-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.icon-btn:hover { background: var(--panel2); color: var(--text); transform: scale(1.05); }
.icon-btn img { width: 20px; height: 20px; display: block; }

/* Main */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: hidden;
  min-height: 0;
}

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
}

.search-container { display: flex; align-items: center; gap: 8px; }

.global-search {
  background: var(--panel2);
  border: 1px solid var(--stroke);
  color: var(--text);
  padding: 0 16px;
  height: 36px;
  border-radius: 100px;
  font-size: 13px;
  width: 260px;
  transition: all 0.2s;
  font-family: inherit;
}
.global-search:focus {
  border-color: var(--pillActive);
  background: #232426;
  outline: none;
  width: 320px;
}
.global-search::placeholder { color: var(--muted); opacity: 0.6; }

.pill {
  background: var(--panel2);
  border: 1px solid var(--stroke);
  color: var(--muted);
  padding: 8px 16px;
  border-radius: 100px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.2s ease;
  height: 36px;
  display: flex;
  align-items: center;
}
.pill:hover { background: #3c3d40; color: var(--text); }

.status-text {
  font-size: 12px;
  color: var(--muted);
  margin-left: auto;
  font-family: monospace;
}

/* Table */
.table-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 200px;
}

.table-wrap {
  flex: 1;
  overflow: auto;
  background: var(--bg);
}

.table-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.table-wrap::-webkit-scrollbar-track { background: var(--bg); }
.table-wrap::-webkit-scrollbar-thumb { background: #444746; border-radius: 4px; }
.table-wrap::-webkit-scrollbar-thumb:hover { background: #5E5E5E; }

.grid {
  width: 100%;
  border-collapse: collapse;
  min-width: 500px;
}

.grid thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--panel2);
  color: var(--text);
  border-bottom: 1px solid var(--stroke);
  border-right: 1px solid var(--stroke);
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
  white-space: nowrap;
  user-select: none;
  cursor: pointer;
}
.grid thead th:hover { background: #37393d; }
.grid thead th.asc .sort-icon::after { content: " ↑"; }
.grid thead th.desc .sort-icon::after { content: " ↓"; }
.sort-icon { color: var(--muted); font-size: 10px; }

.grid tbody td {
  border-bottom: 1px solid #28292a;
  border-right: 1px solid #28292a;
  padding: 8px 16px;
  font-size: 13px;
  white-space: nowrap;
  color: var(--muted);
}
.grid tbody tr:hover td { color: var(--text); background: #1E1F20; }

.code-badge {
  display: inline-block;
  background: var(--panel2);
  border: 1px solid var(--stroke);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  font-family: monospace;
  color: #A8C7FA;
  letter-spacing: 0.5px;
}

.highlight {
  background-color: rgba(230, 192, 42, 0.45);
  color: inherit;
  font-weight: 700;
  border-radius: 2px;
  padding: 0 2px;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  font-size: 14px;
}
