/* =====================================================================
   thesourcemind · protection
   Security operations console — dark slate + gold accent.
   ===================================================================== */

:root {
  --bg:           #0a0e1a;
  --bg-grad:      radial-gradient(1200px 600px at 30% -20%, #16203a 0%, transparent 60%),
                  radial-gradient(900px 500px at 90% 10%, #1a1530 0%, transparent 55%),
                  #0a0e1a;
  --surface:      #131b2e;
  --surface-2:    #1a2340;
  --surface-3:    #232e4d;
  --border:       #243049;
  --border-soft:  rgba(255, 255, 255, 0.06);

  --text:         #e8edf6;
  --text-mute:    #9aa6bd;
  --text-dim:     #5f6c85;

  --gold:         #d4af37;
  --gold-bright:  #f4d160;
  --gold-soft:    rgba(212, 175, 55, 0.12);

  --blue:         #60a5fa;
  --green:        #34d399;
  --amber:        #fbbf24;
  --red:          #f87171;
  --red-strong:   #dc2626;
  --purple:       #a78bfa;

  --radius:       8px;
  --radius-sm:    4px;
  --shadow:       0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.25);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  background: var(--bg);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-bright); text-decoration: underline; text-underline-offset: 2px; }

code, pre, .mono {
  font-family: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  letter-spacing: -0.01em;
}

/* =====================================================================
   Topbar
   ===================================================================== */
.topbar {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 14px 28px;
  background: rgba(10, 14, 26, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-weight: 500;
}
.brand:hover { text-decoration: none; color: var(--gold-bright); }
.brand-icon {
  width: 26px;
  height: 26px;
  color: var(--gold);
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.25));
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-primary {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}
.brand-secondary {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
}

.topbar nav {
  display: flex;
  align-items: center;
  gap: 22px;
  margin-left: auto;
}
.topbar nav a {
  color: var(--text-mute);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.topbar nav a:hover {
  color: var(--text);
  text-decoration: none;
  border-bottom-color: var(--gold);
}
.topbar nav a.nav-alert { color: #fda4af; }
.topbar nav a.nav-alert:hover { color: #fecdd3; border-bottom-color: var(--red); }
.topbar nav a.nav-logout { color: var(--text-dim); margin-left: 12px; }

main { max-width: 1180px; margin: 32px auto 80px; padding: 0 28px; }

/* =====================================================================
   Filter bar (above the table)
   ===================================================================== */
.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-soft);
}
.filters > span:first-child {
  font-size: 13px;
  color: var(--text);
  font-weight: 500;
}
.filters .chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-mute);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
}
.filters .chip a { color: var(--text-dim); margin-left: 2px; font-size: 14px; line-height: 1; }
.filters .chip a:hover { color: var(--text); text-decoration: none; }
.filters .counts {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  gap: 14px;
}
.filters .counts a {
  color: var(--text-mute);
  text-transform: lowercase;
  letter-spacing: 0.02em;
}
.filters .counts a:hover { color: var(--text); text-decoration: none; }

/* =====================================================================
   Detection table
   ===================================================================== */
table.detections {
  width: 100%;
  background: var(--surface);
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
table.detections th {
  text-align: left;
  padding: 11px 16px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  background: var(--surface-2);
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
table.detections td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}
table.detections tr:last-child td { border-bottom: none; }
table.detections tr:hover td { background: rgba(255, 255, 255, 0.015); }
table.detections tr.high td { background: rgba(220, 38, 38, 0.04); }
table.detections tr.high:hover td { background: rgba(220, 38, 38, 0.07); }

table.detections td a {
  color: var(--text);
  font-weight: 500;
}
table.detections td a:hover { color: var(--gold-bright); text-decoration: none; }

/* =====================================================================
   Severity badges (gradient by score)
   ===================================================================== */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  padding: 0 8px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 11.5px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.badge.sev-1, .badge.sev-2, .badge.sev-3 { background: var(--surface-3); color: var(--text-mute); border-color: var(--border); }
.badge.sev-4, .badge.sev-5 { background: rgba(251, 191, 36, 0.12); color: var(--amber); border-color: rgba(251, 191, 36, 0.3); }
.badge.sev-6 { background: rgba(251, 146, 60, 0.14); color: #fb923c; border-color: rgba(251, 146, 60, 0.35); }
.badge.sev-7 { background: rgba(251, 113, 133, 0.14); color: #fb7185; border-color: rgba(251, 113, 133, 0.35); }
.badge.sev-8 { background: rgba(248, 113, 113, 0.16); color: var(--red); border-color: rgba(248, 113, 113, 0.4); }
.badge.sev-9 { background: rgba(220, 38, 38, 0.18); color: #fca5a5; border-color: rgba(220, 38, 38, 0.45); }
.badge.sev-10 {
  background: linear-gradient(180deg, #dc2626 0%, #991b1b 100%);
  color: #fff;
  border-color: rgba(220, 38, 38, 0.6);
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.2), 0 0 12px rgba(220, 38, 38, 0.3);
}

/* =====================================================================
   Signal chips (rule hits, image matches)
   ===================================================================== */
/* =====================================================================
   Source tabs (above the detections table)
   ===================================================================== */
.source-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
  overflow-x: auto;
}
.source-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  color: var(--text-mute);
  font-size: 12.5px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  white-space: nowrap;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.source-tab:hover { color: var(--text); text-decoration: none; }
.source-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}
.source-tab .tab-count {
  background: var(--surface-2);
  color: var(--text-mute);
  padding: 1px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.source-tab.active .tab-count {
  background: rgba(212, 175, 55, 0.15);
  color: var(--gold-bright);
}

/* =====================================================================
   Source badges (in detection rows)
   ===================================================================== */
.source-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  background: var(--surface-2);
  color: var(--text-mute);
  border: 1px solid var(--border);
  white-space: nowrap;
}
.source-foreplay        { background: rgba(96, 165, 250, 0.1); color: #93c5fd; border-color: rgba(96, 165, 250, 0.25); }
.source-serpapi_amazon  { background: rgba(251, 146, 60, 0.1); color: #fdba74; border-color: rgba(251, 146, 60, 0.25); }
.source-serpapi_google  { background: rgba(167, 139, 250, 0.1); color: #c4b5fd; border-color: rgba(167, 139, 250, 0.25); }
.source-serpapi_google_ads { background: rgba(52, 211, 153, 0.1); color: #6ee7b7; border-color: rgba(52, 211, 153, 0.25); }
.source-meta_ad_library { background: rgba(96, 165, 250, 0.08); color: #93c5fd; border-color: rgba(96, 165, 250, 0.2); }

.signals { line-height: 2; }
.signals .rule {
  display: inline-flex;
  align-items: center;
  background: var(--surface-2);
  color: var(--text-mute);
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  margin-right: 4px;
  font-family: ui-monospace, monospace;
  border: 1px solid var(--border);
}
.signals .rule.img {
  background: rgba(212, 175, 55, 0.1);
  color: var(--gold-bright);
  border-color: rgba(212, 175, 55, 0.3);
}

/* =====================================================================
   Status pills
   ===================================================================== */
.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  text-transform: lowercase;
}
.status::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  display: inline-block;
}
.status-new            { background: rgba(96, 165, 250, 0.1); color: var(--blue); border-color: rgba(96, 165, 250, 0.25); }
.status-new::before    { background: var(--blue); box-shadow: 0 0 6px rgba(96, 165, 250, 0.6); }
.status-confirmed      { background: rgba(220, 38, 38, 0.12); color: #fca5a5; border-color: rgba(220, 38, 38, 0.3); }
.status-confirmed::before { background: var(--red-strong); box-shadow: 0 0 6px rgba(220, 38, 38, 0.6); }
.status-false_positive { background: rgba(52, 211, 153, 0.1); color: var(--green); border-color: rgba(52, 211, 153, 0.25); }
.status-false_positive::before { background: var(--green); }
.status-monitor        { background: rgba(251, 191, 36, 0.1); color: var(--amber); border-color: rgba(251, 191, 36, 0.25); }
.status-monitor::before { background: var(--amber); }
.status-dmca_filed     { background: rgba(167, 139, 250, 0.1); color: var(--purple); border-color: rgba(167, 139, 250, 0.25); }
.status-dmca_filed::before { background: var(--purple); }

/* =====================================================================
   Misc
   ===================================================================== */
.meta { color: var(--text-dim); font-size: 11.5px; }
.empty { color: var(--text-dim); text-align: center; padding: 36px; font-style: italic; }
hr { border: none; border-top: 1px solid var(--border-soft); margin: 24px 0; }

/* =====================================================================
   Detail page
   ===================================================================== */
.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 16px;
  color: var(--text-mute);
  font-size: 12.5px;
}
.back:hover { color: var(--text); text-decoration: none; }

.detection-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border-soft);
}
.detection-header h1 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 12px;
  letter-spacing: -0.01em;
}
.detection-header h1 .badge { font-size: 13px; min-width: 36px; height: 24px; }

.status-form {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.status-form label {
  font-size: 10.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}
.status-form select {
  padding: 5px 10px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
}
.status-form select:focus { outline: 2px solid var(--gold); outline-offset: -1px; border-color: var(--gold); }
.status-form button {
  padding: 6px 14px;
  background: var(--gold);
  color: #1a1300;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: background 0.12s ease;
}
.status-form button:hover { background: var(--gold-bright); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 22px 26px;
  border-radius: var(--radius);
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-mute);
  text-transform: uppercase;
  letter-spacing: 0.16em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.card h2::before {
  content: "";
  width: 3px;
  height: 14px;
  background: var(--gold);
  border-radius: 2px;
}
.card h3 {
  margin: 18px 0 8px;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-weight: 600;
}

.row { display: flex; gap: 16px; margin-bottom: 12px; align-items: flex-start; }
.row > label {
  width: 96px;
  flex-shrink: 0;
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  padding-top: 3px;
}
.row > div { color: var(--text); flex: 1; min-width: 0; word-break: break-word; }

.quote {
  background: var(--surface-2);
  border-left: 2px solid var(--gold);
  padding: 10px 14px;
  font-style: italic;
  color: #cbd5e1;
  border-radius: 0 4px 4px 0;
}
.quote.small { font-size: 11.5px; padding: 7px 12px; margin-top: 6px; }

.creatives a {
  display: block;
  font-size: 11.5px;
  font-family: ui-monospace, monospace;
  padding: 3px 0;
  color: var(--text-mute);
}
.creatives a:hover { color: var(--gold-bright); }

.hits { list-style: none; padding: 0; margin: 0; }
.hits li {
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
}
.hits li:last-child { border-bottom: none; }
.hits li code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 3px;
  color: var(--gold-bright);
}

.evidence { list-style: none; padding: 0; margin: 0; }
.evidence li {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.evidence li:last-child { border-bottom: none; }
.evidence li > strong {
  display: inline-block;
  min-width: 220px;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-mute);
}
.evidence li a {
  font-size: 12px;
}
.thumb {
  display: block;
  flex-basis: 100%;
  max-width: 720px;
  margin-top: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
}

pre {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  color: var(--text-mute);
  font-size: 11.5px;
  white-space: pre-wrap;
}

/* =====================================================================
   Login page
   ===================================================================== */
body.login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  background-image:
    radial-gradient(800px 400px at 50% 0%, rgba(212, 175, 55, 0.06) 0%, transparent 60%),
    radial-gradient(900px 500px at 50% 100%, #16203a 0%, transparent 55%),
    var(--bg);
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 40px 40px 28px;
  border-radius: 12px;
  width: 380px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(212, 175, 55, 0.05);
  text-align: center;
  position: relative;
}
.login-icon {
  width: 48px;
  height: 48px;
  color: var(--gold);
  margin: 0 auto 18px;
  display: block;
  filter: drop-shadow(0 0 18px rgba(212, 175, 55, 0.35));
}
.login-brand { margin-bottom: 28px; }
.login-brand-primary {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text);
}
.login-brand-secondary {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  margin-top: 4px;
}

.login-card form { text-align: left; }
.login-card label { display: block; }
.login-card label > span {
  display: block;
  font-size: 10.5px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  margin-bottom: 8px;
  font-weight: 600;
}
.login-card input[type="password"] {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-family: ui-monospace, monospace;
  color: var(--text);
  letter-spacing: 0.04em;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.login-card input[type="password"]:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.12);
}

.login-card button {
  width: 100%;
  margin-top: 18px;
  padding: 11px;
  background: var(--gold);
  color: #1a1300;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.12s ease;
}
.login-card button:hover { background: var(--gold-bright); }

.login-card .error {
  background: rgba(220, 38, 38, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(220, 38, 38, 0.3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  margin-bottom: 16px;
  text-align: left;
}

.login-footer {
  margin-top: 24px;
  font-size: 10.5px;
  color: var(--text-dim);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
