:root {
  color-scheme: light;
  --bg: #f2f4f7;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #6b7c93;
  --accent: #1b998b;
  --accent-dark: #0f6f65;
  --danger: #b91c1c;
  --border: #e5e9f0;
  --badge-green: #16a34a;
  --badge-gray: #94a3b8;
  --badge-red: #dc2626;
  --badge-amber: #f59e0b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #f2f4f7 0%, #e0f0ee 100%);
  color: var(--text);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  background: #0f172a;
  color: #f8fafc;
}

.brand {
  font-weight: 700;
  letter-spacing: 0.5px;
}

.status {
  padding: 6px 12px;
  border-radius: 999px;
  background: #334155;
  color: #e2e8f0;
  font-size: 12px;
}

.status.ok {
  background: #16a34a;
  color: white;
}

main {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 24px 48px;
  display: grid;
  gap: 16px;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px 24px 0;
  background: #0f172a;
}

.tab {
  background: transparent;
  color: #cbd5f5;
  border: 1px solid rgba(148, 163, 184, 0.4);
  border-radius: 999px;
  padding: 8px 16px;
  font-weight: 600;
}

.tab.active {
  background: #1b998b;
  border-color: #1b998b;
  color: #fff;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.card {
  background: var(--card);
  padding: 20px;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.spacer {
  height: 24px;
}

h2 {
  margin-top: 0;
}

label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}

input, select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
}

button {
  background: var(--accent);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-weight: 600;
}

button:hover {
  background: var(--accent-dark);
}

button.ghost {
  background: transparent;
  color: var(--accent-dark);
  border: 1px solid var(--border);
}

button.ghost:hover {
  background: rgba(15, 118, 110, 0.08);
}

.row {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.field {
  flex: 1;
}

.field.small {
  max-width: 160px;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filters {
  display: grid;
  gap: 8px;
  grid-template-columns: 1fr 200px;
  margin-bottom: 12px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
  margin-top: 6px;
}

.checkbox input {
  width: auto;
  margin: 0;
}

#streams-table,
#shares-table,
#sources-table,
#wave-table,
#verkada-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

#streams-table th,
#streams-table td,
#shares-table th,
#shares-table td,
#sources-table th,
#sources-table td,
#wave-table th,
#wave-table td,
#verkada-table th,
#verkada-table td {
  text-align: left;
  padding: 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

#streams-table button,
#sources-table button,
#wave-table button,
#verkada-table button {
  margin-right: 8px;
}

.stream-name {
  font-weight: 600;
}

.stream-id {
  font-size: 11px;
  color: var(--muted);
}

.badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.running,
.badge.reachable {
  background: rgba(22, 163, 74, 0.15);
  color: var(--badge-green);
}

.badge.stopped,
.badge.unknown {
  background: rgba(148, 163, 184, 0.2);
  color: #475569;
}

.badge.unreachable,
.badge.stale {
  background: rgba(245, 158, 11, 0.2);
  color: var(--badge-amber);
}

.badge.external {
  background: rgba(14, 116, 144, 0.18);
  color: #0e7490;
}

.hint {
  color: var(--muted);
  font-size: 12px;
}

.share-result {
  margin-top: 12px;
  font-weight: 600;
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: "IBM Plex Mono", "SFMono-Regular", ui-monospace, monospace;
  font-size: 12px;
}

a {
  color: var(--accent-dark);
  font-weight: 600;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.55);
  padding: 24px;
  z-index: 50;
}

.modal.active {
  display: flex;
}

.modal-card {
  background: var(--card);
  padding: 20px;
  border-radius: 12px;
  width: min(520px, 100%);
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.2);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

@media (max-width: 720px) {
  header {
    flex-direction: column;
    gap: 8px;
    align-items: flex-start;
  }

  .row {
    flex-direction: column;
  }

  .filters {
    grid-template-columns: 1fr;
  }

  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
}
