:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface2: #273347;
  --border: #334155;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --green: #22c55e;
  --yellow: #f59e0b;
  --red: #ef4444;
  --radius: 8px;
}

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

body {
  font-family: system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 2rem;
  height: 56px;
}

header h1 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

nav { display: flex; gap: 4px; }

.nav-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  transition: all 0.15s;
}
.nav-btn:hover { background: var(--surface2); color: var(--text); }
.nav-btn.active { background: var(--accent); color: #fff; }

main { max-width: 960px; margin: 2rem auto; padding: 0 1.5rem; }

.section { display: none; }
.section.active { display: block; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-header h2 { font-size: 1.25rem; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.hidden { display: none !important; }

.form-row {
  display: grid;
  grid-template-columns: 140px 1fr;
  align-items: start;
  gap: 8px;
  margin-bottom: 12px;
}

.form-row label {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding-top: 6px;
}

input[type="text"], input[type="url"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  padding: 6px 10px;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}
input:focus { border-color: var(--accent); }

.input-with-hint { display: flex; flex-direction: column; gap: 4px; }
.hint { font-size: 0.78rem; color: var(--text-muted); }

.form-actions { display: flex; gap: 8px; margin-top: 8px; }

.btn {
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.875rem;
  padding: 7px 14px;
  transition: all 0.15s;
}
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--border); }
.btn-ghost { background: none; color: var(--text-muted); border: 1px solid var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--surface2); }
.btn-danger { background: none; color: var(--red); border: 1px solid var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
th { color: var(--text-muted); text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }

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

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}
.badge-green { background: #14532d; color: var(--green); }
.badge-yellow { background: #451a03; color: var(--yellow); }
.badge-red { background: #450a0a; color: var(--red); }
.badge-gray { background: var(--surface2); color: var(--text-muted); }
.badge-blue { background: #1e3a5f; color: var(--accent); }

.status-row { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }

.loading { color: var(--text-muted); font-size: 0.875rem; padding: 8px 0; }

.empty { color: var(--text-muted); font-size: 0.875rem; text-align: center; padding: 2rem; }

.source-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.source-row:last-child { border-bottom: none; }
.source-info { flex: 1; min-width: 0; }
.source-name { font-weight: 600; font-size: 0.9rem; }
.source-url { color: var(--text-muted); font-size: 0.78rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
