/* grim-reaper frontend — dependency-free. Tokens mirror the selfservice UI. */
:root {
  --red: #e10728;
  --black: #1f1f1f;
  --border: #e5e7eb;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-400: #9ca3af;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --text: #1f1f1f;
  --bg: #f5f6f8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

/* --- Top bar: black with white logo (mirrors .base-header) --- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  background-color: var(--black);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.25);
}
.topbar__logo-link { display: inline-flex; }
.topbar__logo {
  height: 40px;
  width: auto;
  display: block;
}
@media (min-width: 770px)  { .topbar { padding: 1.25rem 2.5rem; } .topbar__logo { height: 50px; } }
@media (min-width: 1024px) { .topbar { padding: 1.5rem 3rem; }    .topbar__logo { height: 60px; } }

/* --- Page --- */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}
.page__title {
  margin: 0 0 0.25rem;
  font-size: 2rem;
  font-weight: 700;
}
.page__subtitle {
  margin: 0 0 1.5rem;
  color: var(--gray-500);
}

/* --- Disclaimer notice --- */
.notice {
  margin: 0 0 1.5rem;
  padding: 0.75rem 1rem;
  background: #fef8e2;
  border: 1px solid #f5d987;
  border-left: 4px solid #d9a300;
  border-radius: 8px;
  color: #6b4e00;
  font-size: 0.9rem;
}

/* --- Toolbar --- */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
  margin-bottom: 1.25rem;
}
.toolbar__actions { display: flex; gap: 0.75rem; }
.toolbar__status {
  color: var(--gray-500);
  font-size: 0.9rem;
  min-height: 1.25rem;
}
.toolbar__status .status-line { display: block; }
.toolbar__status .status-name { color: var(--gray-700); font-weight: 600; }
.toolbar__status .status-err { color: var(--red); font-weight: 600; }

.btn {
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border: 1px solid var(--black);
  border-radius: 8px;
  background: #fff;
  color: var(--black);
  cursor: pointer;
  transition: background 0.12s ease, opacity 0.12s ease;
}
.btn:hover:not(:disabled) { background: var(--gray-100); }
.btn:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  border-color: var(--gray-400);
  color: var(--gray-500);
}

/* --- Card + table (screenshot-style) --- */
/* The card is the table's scroll container: too narrow a viewport scrolls the
   table sideways instead of clipping its right half. The four background layers
   are the classic pure-CSS scroll hint — `local` white covers, `scroll` shadows
   underneath — so an edge shadow shows only while there's more to scroll to. */
.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.06);
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  background:
    linear-gradient(to right, #fff 40%, rgba(255, 255, 255, 0)) left center,
    linear-gradient(to left, #fff 40%, rgba(255, 255, 255, 0)) right center,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0)) left center,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, 0.16), rgba(0, 0, 0, 0)) right center,
    #fff;
  background-repeat: no-repeat;
  background-size: 44px 100%, 44px 100%, 18px 100%, 18px 100%;
  background-attachment: local, local, scroll, scroll;
}
.table {
  width: 100%;
  /* Below this the eight columns squash into unreadable slivers; the card
     scrolls instead. */
  min-width: 940px;
  border-collapse: collapse;
  font-size: 0.925rem;
}
/* Name is the column that has to stay readable when the table is squeezed —
   without a floor it collapses to a few characters per line. */
.table .col-name { min-width: 13rem; }
.table thead th {
  text-align: left;
  font-weight: 600;
  color: var(--gray-700);
  background: var(--gray-50);
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.table th.num, .table td.num { text-align: right; }
.table tbody td {
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--gray-100);
  vertical-align: top;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--gray-50); }

.code { font-variant-numeric: tabular-nums; font-weight: 600; }
.ext-link { color: inherit; text-decoration: none; border-bottom: 1px dotted var(--gray-400); }
.ext-link:hover { color: var(--red); border-bottom-color: var(--red); }
.social-links { display: inline-flex; gap: 6px; margin-left: 8px; vertical-align: middle; }
.social-icon { display: inline-flex; color: var(--gray-400); line-height: 0; }
.social-icon:hover { color: var(--red); }
.muted { color: var(--gray-400); }
/* Bio status icon (full text shown on hover via .bio-pop). */
.bio-cell {
  display: inline-flex;
  cursor: default;
  outline: none;
}
/* When there's an IG handle the icon is a link to the profile. */
a.bio-cell {
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.bio-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}
.bio-icon--ok { background: #e7f6ec; color: #1a7f43; }
.bio-icon--flag { background: #fde7ea; color: var(--red); }
.bio-cell:focus-visible .bio-icon {
  box-shadow: 0 0 0 2px var(--gray-400);
}

/* Floating bio bubble: fixed-positioned by JS, so the card's overflow:hidden
   never clips it. Hidden via opacity/visibility (not display) so it can be
   measured for positioning while off-screen. */
.bio-pop {
  position: fixed;
  z-index: 100;
  min-width: 160px;
  max-width: 320px;
  padding: 0.6rem 0.75rem;
  background: var(--black);
  color: #fff;
  border-radius: 8px;
  font-size: 0.82rem;
  line-height: 1.45;
  white-space: normal;
  overflow-wrap: anywhere;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.12s ease;
  pointer-events: none;
}
.bio-pop.visible { opacity: 1; visibility: visible; }
.empty {
  text-align: center;
  color: var(--gray-500);
  padding: 2.5rem 1rem;
}

/* --- Badges / flag emphasis (ports the pipeline's out-of-bounds bolding) --- */
.badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--gray-100);
  color: var(--gray-700);
  white-space: nowrap;
}
.badge--ok { background: #e7f6ec; color: #1a7f43; }

/* Badge wrapped in a link (→ Google Maps). No underline — the badge is the
   affordance; hover just lifts it slightly. */
.badge-link { text-decoration: none; }
.badge-link:hover .badge { filter: brightness(0.94); }

/* A flagged (out-of-bounds) value: red + bold. */
.flagged { color: var(--red); font-weight: 700; }
.badge.flagged { background: #fde7ea; color: var(--red); }

.flags { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.flag-chip {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  background: #fde7ea;
  color: var(--red);
  white-space: nowrap;
}
.anomaly-count {
  font-size: 0.78rem;
  color: var(--gray-500);
  font-weight: 600;
}

/* Weighted risk score pill, colored by tier (see riskCell in app.js). */
.risk-score {
  display: inline-block;
  min-width: 2.25rem;
  text-align: center;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.risk-score.risk--high { background: #fde7ea; color: var(--red); }
.risk-score.risk--mid { background: #fef3e2; color: #b45309; }
.risk-score.risk--low { background: var(--gray-100); color: var(--gray-700); }

/* --- Small screens: give the table back the space the page chrome takes --- */
@media (max-width: 640px) {
  .page { padding: 1.25rem 1rem; }
  .page__title { font-size: 1.6rem; }
  .table thead th { padding: 0.7rem 0.75rem; }
  .table tbody td { padding: 0.7rem 0.75rem; }
}
