:root {
  /* SitesFeed brand palette (see brand guide.md) */
  --primary: #155bff;
  --primary-dark: #0e46cc;
  --navy: #050d2f;
  --text: #07142f;
  --text-muted: #667085;
  --bg: #f3f7ff;
  --surface: #ffffff;
  --border: #dde7f5;
  --success: #12b76a;
  --success-bg: #e9faf2;
  --danger: #b91c1c;
  --danger-bg: #fef2f2;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --radius-card: 18px;
  --radius-btn: 11px;
  --radius-input: 9px;
  --shadow-soft: 0 1px 2px rgba(5, 13, 47, 0.04), 0 8px 24px rgba(5, 13, 47, 0.05);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

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

h1,
h2,
h3 {
  font-family: "Sora", "Inter", sans-serif;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0 0 4px;
  color: var(--navy);
}

/* ── Brand lockup ────────────────────────────────────────── */
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-lockup img.brand-icon {
  width: 28px;
  height: 28px;
  display: block;
}
.brand-lockup .brand-name {
  font-family: "Sora", "Inter", sans-serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--navy);
}
.brand-wordmark {
  display: block;
  height: 34px;
  width: auto;
  margin: 0 auto 20px;
}

/* ── Auth pages (login/setup) ───────────────────────────── */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 10%, #eaf1ff 0%, var(--bg) 55%);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 32px;
}
.auth-card h1 {
  font-size: 19px;
  text-align: center;
}
.auth-card p.hint {
  color: var(--text-muted);
  font-size: 13px;
  margin: 4px 0 20px;
  text-align: center;
}

/* ── App shell ───────────────────────────────────────────── */
#app {
  display: flex;
  min-height: 100vh;
}
.sidebar {
  width: 224px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 12px;
  display: flex;
  flex-direction: column;
}
.sidebar .brand {
  padding: 4px 8px 20px;
}
.sidebar nav a {
  display: block;
  padding: 9px 10px;
  border-radius: var(--radius-input);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background 0.15s ease;
}
.sidebar nav a:hover {
  background: var(--bg);
  text-decoration: none;
}
.sidebar nav a.active {
  background: #eaf0ff;
  color: var(--primary-dark);
  font-weight: 700;
}
.sidebar .spacer {
  flex: 1;
}
.sidebar .user-box {
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 8px 2px;
  border-top: 1px solid var(--border);
}
.sidebar .user-box .email {
  color: var(--text);
  font-weight: 600;
  display: block;
  margin-bottom: 6px;
  word-break: break-all;
}

.main {
  flex: 1;
  min-width: 0;
}
.content {
  padding: 26px 30px;
  max-width: 1200px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap;
  gap: 8px;
}
.page-title {
  font-size: 21px;
}

/* ── Components ──────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 18px;
  margin-bottom: 18px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.stat-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 16px 18px;
}
.stat-tile .value {
  font-family: "Sora", "Inter", sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--navy);
}
.stat-tile .label {
  font-size: 12px;
  color: var(--text-muted);
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar input[type="text"],
.toolbar select {
  padding: 8px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
}
.toolbar .spacer {
  flex: 1;
}

.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th,
td {
  text-align: left;
  padding: 10px 10px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
td.wrap {
  white-space: normal;
}
tr:hover td {
  background: #f8faff;
}

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-pending {
  background: #eef1f5;
  color: var(--text-muted);
}
.badge-found {
  background: var(--success-bg);
  color: var(--success);
}
.badge-not_found {
  background: #eef1f5;
  color: var(--text-muted);
}
.badge-blocked {
  background: var(--warn-bg);
  color: var(--warn);
}
.badge-error {
  background: var(--danger-bg);
  color: var(--danger);
}

button,
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  background: var(--surface);
  color: var(--navy);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  transition: background 0.15s ease, box-shadow 0.15s ease, transform 0.05s ease;
}
button:hover {
  background: var(--bg);
}
button:active {
  transform: translateY(1px);
}
button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background: var(--primary-dark);
  box-shadow: 0 0 0 4px rgba(21, 91, 255, 0.15);
}
.btn-danger {
  color: var(--danger);
  border-color: #f3c9c9;
  background: var(--surface);
}
.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 8px;
}

.alert {
  padding: 11px 13px;
  border-radius: var(--radius-input);
  font-size: 13px;
  margin-bottom: 12px;
}
.alert-error {
  background: var(--danger-bg);
  color: var(--danger);
}
.alert-success {
  background: var(--success-bg);
  color: var(--success);
}

.spinner {
  width: 22px;
  height: 22px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 24px auto;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.field {
  margin-bottom: 14px;
}
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--navy);
}
.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: var(--radius-input);
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(21, 91, 255, 0.12);
}
.field .hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(5, 13, 47, 0.45);
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 22px;
  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.modal-header h2 {
  font-size: 17px;
}
.modal-close {
  border: none;
  background: none;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  color: var(--text-muted);
}

code,
.mono {
  font-family: ui-monospace, Consolas, monospace;
  font-size: 12px;
  background: var(--bg);
  padding: 2px 5px;
  border-radius: 4px;
}

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 200;
}
.toast {
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-input);
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(5, 13, 47, 0.25);
}
.toast.error {
  background: var(--danger);
}
