:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --border: #2d3a4f;
  --text: #e7ecf3;
  --muted: #9aa8bc;
  --accent: #0078d4;
  --accent-hover: #106ebe;
  --danger: #f1707b;
  --success: #6ccb5f;
  --radius: 10px;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

header h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

header p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
}

button,
select,
input[type="search"] {
  font: inherit;
}

button {
  border: none;
  border-radius: 8px;
  padding: 0.55rem 1rem;
  cursor: pointer;
  background: var(--accent);
  color: white;
}

button:hover:not(:disabled) {
  background: var(--accent-hover);
}

button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

main {
  padding: 1.5rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.filters input,
.filters select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
}

.filters input {
  min-width: 260px;
  flex: 1;
}

#status-bar {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: 0.9rem;
}

#status-bar.error {
  border-color: var(--danger);
  color: var(--danger);
}

.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 960px;
}

th,
td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #152030;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

tr:hover td {
  background: rgba(0, 120, 212, 0.08);
}

a {
  color: #4db3ff;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

code {
  font-size: 0.85rem;
  color: #c5d4e8;
}

.tags {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--muted);
  font-size: 0.85rem;
}

.sub-id {
  font-family: Consolas, monospace;
  font-size: 0.85rem;
}

.btn-link {
  white-space: nowrap;
}

#empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--muted);
}

#user-label {
  color: var(--muted);
  font-size: 0.9rem;
}

.page-nav {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  background: #121a26;
  border-bottom: 1px solid var(--border);
}

.page-nav a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.9rem;
}

.page-nav a.active,
.page-nav a:hover {
  color: var(--text);
  background: rgba(0, 120, 212, 0.15);
}

.subscription-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.sub-tab {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  font-size: 0.85rem;
}

.sub-tab.active {
  background: var(--accent);
  border-color: var(--accent);
}

.table-wrap.wide table {
  min-width: 1800px;
}

@media (max-width: 768px) {
  header {
    flex-direction: column;
    align-items: flex-start;
  }
}
