/* ==========================================================================
   Fake Site Scanner — styled to match the Unshadow console (app/static/app.css).
   Design DNA: monospace type, sharp corners, uppercase letter-spaced controls,
   the shared #68A2B9 brand accent, and a data-theme dark mode.
   Class names are kept identical to the portal markup so the HTML/JS are
   untouched — this file only re-skins them.
   ========================================================================== */

:root {
  /* Base palette (light) — identical tokens to the Unshadow console. */
  --fg: #0a0a0a;
  --bg: #ffffff;
  --muted: #8a8a8a;
  --line: #0a0a0a;
  --soft: #cfcfcf;
  --brand: #68A2B9;
  --brand-dark: #4d8299;
  --nav-h: 52px;
  --content-max: 1600px;

  /* Semantic surface tokens (light). */
  --surface-alt: #fafafa;
  --surface-alt-strong: #ededed;
  --surface-accent: #f0f7fa;
  --danger: #c0392b;
  --danger-hover: #a4322a;
  --ok: #2e7d32;
  --warn: #c8641d;

  --modal-backdrop: rgba(0, 0, 0, .40);
  --shadow-drawer: 0 4px 16px rgba(0, 0, 0, .12);
}

/* Dark theme — toggled via the data-theme attribute (see theme-init.js). */
html[data-theme="dark"] {
  --fg: #f2f2f2;
  --bg: #0e1116;
  --muted: #9aa1a8;
  --line: #424c58;
  --soft: #333b45;
  --brand: #7fb9d1;
  --brand-dark: #9fccdd;

  --surface-alt: #161b21;
  --surface-alt-strong: #1c2229;
  --surface-accent: #17272f;
  --danger: #d45a4a;
  --danger-hover: #b84a3c;
  --ok: #4ec46f;
  --warn: #e0913c;

  --modal-backdrop: rgba(0, 0, 0, .65);
  --shadow-drawer: 0 4px 16px rgba(0, 0, 0, .55);

  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "JetBrains Mono", "SFMono-Regular", ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background-color .18s ease, color .18s ease;
}

a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-dark); }

.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ---- top bar ---- */
header.topbar {
  height: var(--nav-h);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  position: sticky;
  top: 0;
  z-index: 60;
  background: var(--bg);
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--brand);
  font-size: 18px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
}
.brand .dot {
  width: 10px; height: 10px; border-radius: 0;
  background: var(--brand);
  box-shadow: 0 0 0 3px rgba(104, 162, 185, 0.22);
}
.brand small {
  display: block;
  font-weight: 400;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 10px;
  margin-top: 2px;
}

.who {
  display: flex; align-items: center; gap: 12px;
  color: var(--muted);
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
}
#who-email { overflow-wrap: anywhere; }

/* ---- topbar controls (theme + language), styled like Unshadow .btn-mini ---- */
.topctl {
  font: inherit; font-size: 10px; letter-spacing: 0.12em; text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  padding: 5px 10px; border-radius: 0; line-height: 1.2;
  transition: background .12s ease, color .12s ease;
}
.topctl:hover { background: var(--surface-alt); }
.lang-toggle { min-width: 40px; text-align: center; font-weight: 600; }

/* ---- sortable table headers + search ---- */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--fg); }
.sort-ind { color: var(--brand); font-size: 10px; }
.table-search {
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 0;
  font: inherit; background: var(--bg); color: var(--fg); min-width: 240px;
}
.table-search:focus { outline: none; background: var(--surface-alt); }

/* ---- buttons ---- */
button {
  font: inherit;
  cursor: pointer;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 0;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 11px;
  transition: opacity .12s ease, background .12s ease, color .12s ease, border-color .12s ease;
}
button:hover { opacity: .82; }
button.primary { background: var(--brand); border-color: var(--brand); color: var(--bg); }
button.primary:hover { opacity: .82; }
button.danger { background: var(--bg); border-color: var(--danger); color: var(--danger); }
button.danger:hover { background: var(--danger); color: #fff; opacity: 1; }
button.ghost { background: var(--bg); border-color: var(--line); color: var(--fg); }
button.ghost:hover { background: var(--surface-alt); opacity: 1; }
button.mini {
  padding: 5px 10px; font-size: 10px; letter-spacing: 0.12em; border-radius: 0;
  background: var(--bg); border-color: var(--line); color: var(--fg);
}
button.mini:hover { background: var(--surface-alt); opacity: 1; }
button.mini.primary { background: var(--brand); border-color: var(--brand); color: var(--bg); }
button.mini.primary:hover { opacity: .82; }
button.mini.ghost { background: var(--bg); color: var(--muted); }
button.mini.ghost:hover { background: var(--surface-alt); color: var(--fg); }

/* ---- login ---- */
.login-wrap {
  min-height: calc(100vh - var(--nav-h));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 34px 30px;
  background: var(--bg);
}
.login-card h1 { margin: 0 0 6px; font-size: 16px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; }
.login-card p.sub { margin: 0 0 24px; color: var(--muted); font-size: 12px; }
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.18em; color: var(--muted); margin-bottom: 8px;
}
.field input, .field select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  font: inherit;
  background: var(--bg);
  color: var(--fg);
}
.field input:focus, .field select:focus { outline: none; background: var(--surface-alt); border-color: var(--brand); }
.login-card button { width: 100%; margin-top: 8px; }
.login-hint { margin-top: 18px; font-size: 10px; letter-spacing: 0.08em; color: var(--muted); text-align: center; text-transform: uppercase; }
.form-error { color: var(--danger); font-size: 12px; margin: 10px 0 0; min-height: 16px; }

/* ---- main content ---- */
main { padding: 40px 48px 80px; max-width: var(--content-max); margin: 0 auto; }
.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.page-head h2 { margin: 0; }
h2 {
  font-size: 15px; letter-spacing: 0.12em; text-transform: uppercase;
  margin: 0 0 20px; padding-bottom: 12px; border-bottom: 1px solid var(--line); font-weight: 600;
}
.page-sub { color: var(--muted); font-size: 12px; margin: 0 0 20px; max-width: 780px; }
.toolbar { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar label {
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted);
  display: inline-flex; align-items: center; gap: 7px;
}

/* ---- table ---- */
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  white-space: nowrap;
  font-weight: 600;
}
tbody td { padding: 12px 10px; border-bottom: 1px solid var(--soft); vertical-align: top; font-size: 13px; }
tbody tr:hover td { background: var(--surface-alt); }
.site-url { font-weight: 600; overflow-wrap: anywhere; }
.site-dom { color: var(--muted); font-size: 12px; }

.reason { max-width: 460px; cursor: pointer; }
.reason .toggle { color: var(--brand); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; white-space: nowrap; }

/* ---- severity badges (match Unshadow sev-* palette) ---- */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #fff;
  border: 1px solid transparent;
}
.sev-critical { background: #b71c1c; color: #ffffff; border-color: #7f0000; }
.sev-high     { background: #e53935; color: #ffffff; border-color: #b71c1c; }
.sev-medium   { background: #f9a825; color: #1a1300; border-color: #c17900; }
.sev-low      { background: #1976d2; color: #ffffff; border-color: #0d47a1; }
.sev-none     { background: #9e9e9e; color: #ffffff; border-color: #616161; }
html[data-theme="dark"] .sev-critical { background: #8e1c1c; color: #fff5f5; border-color: #5a0000; }
html[data-theme="dark"] .sev-high     { background: #a93636; color: #ffe6e6; border-color: #6a1010; }
html[data-theme="dark"] .sev-medium   { background: #b07208; color: #fff4d6; border-color: #7a4d00; }
html[data-theme="dark"] .sev-low      { background: #1b5aa6; color: #e3f0ff; border-color: #0a3a75; }
html[data-theme="dark"] .sev-none     { background: #5a6068; color: #e8e8e8; border-color: #3a3f45; }

.status-active { color: var(--danger); font-weight: 600; }
.status-fp { color: var(--muted); }

.td-requested { color: var(--warn); font-weight: 600; }
.td-in_progress { color: var(--warn); font-weight: 600; }
.td-completed { color: var(--ok); font-weight: 600; }
.td-failed { color: var(--danger); font-weight: 600; }
.td-rejected { color: var(--muted); }
.td-none { color: var(--muted); }

/* The outcome an analyst reported back. It is the answer the customer has
   been waiting for, so it reads as a callout rather than another grey line. */
.td-outcome {
  margin-top: 4px;
  padding: 5px 8px;
  border-left: 3px solid var(--muted);
  background: var(--surface-alt);
  border-radius: 0 4px 4px 0;
  font-size: 11px;
  line-height: 1.45;
  white-space: normal;
  max-width: 260px;
}
.td-outcome-completed { border-left-color: var(--ok); }
.td-outcome-failed { border-left-color: var(--danger); }
.td-outcome-rejected { border-left-color: var(--muted); }

/* Shown instead of a Cancel button once we have started the work. */
.mini-note { font-size: 11px; color: var(--muted); font-style: italic; }

/* ---- takedown credit balance ---- */
.quota-bar {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent, var(--ok));
  border-radius: 4px;
  background: var(--surface-alt);
  font-size: 12px;
}
.quota-bar strong { font-size: 18px; line-height: 1; }
.quota-bar .muted { font-size: 11px; }
.quota-empty { border-left-color: var(--danger); }
.quota-empty strong { color: var(--danger); }

/* ---- search engine status ---- */
.engines-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 16px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.engines-head h4 { margin: 0; font-size: 13px; }
.engine-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.engine-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-alt);
  font-size: 11px;
}
.engine-chip b { font-size: 12px; font-weight: 600; }
.engine-chip span { color: var(--muted); }
.engine-on { border-color: var(--ok); }
.engine-on b { color: var(--ok); }
.engine-blocked { border-color: var(--warn); }
.engine-blocked b { color: var(--warn); }
.engine-off { opacity: 0.6; }

.row-actions { white-space: nowrap; display: flex; gap: 8px; flex-wrap: wrap; }

.empty { padding: 48px 0; text-align: center; color: var(--muted); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---- toast (bottom-right, uppercase letter-spaced, like Unshadow) ---- */
#toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--fg);
  color: var(--bg);
  padding: 12px 18px;
  border-radius: 0;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease;
  z-index: 9999;
}
#toast.show { opacity: 1; }

/* ---- modal (note prompt / account) ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 10000;
  background: var(--modal-backdrop);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.modal {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0;
  width: 100%; max-width: 440px;
  padding: 24px 24px 20px;
  box-shadow: var(--shadow-drawer);
}
.modal h3 { margin: 0 0 8px; font-size: 13px; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600; }
.modal p { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.modal textarea {
  width: 100%; min-height: 74px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 0; font: inherit; resize: vertical;
  background: var(--bg); color: var(--fg);
}
.modal textarea:focus { outline: none; background: var(--surface-alt); border-color: var(--brand); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

footer.foot {
  text-align: center; color: var(--muted); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 24px; border-top: 1px solid var(--soft);
}

/* ---- admin layout ---- */
.admin-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 820px) {
  .admin-grid { grid-template-columns: 1fr; }
}
/* Stacked admin layout: the customer list sits on top and the (bigger)
   detail box sits beneath it, both full width. */
.admin-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
  align-items: stretch;
}
/* In the stacked layout the customer list renders as a wrapping grid of
   cards so it stays compact on top, leaving room for the detail box. */
.admin-stack .cust-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
}
/* The detail box is the primary working area — give it generous height. */
.detail-panel { min-height: 520px; }
.panel {
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 20px 24px;
}
.panel h3 { margin: 0 0 14px; font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; font-weight: 600; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.panel-head h3 { margin: 0; }

.cust-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.cust-item {
  border: 1px solid var(--soft);
  border-radius: 0;
  padding: 11px 12px;
  cursor: pointer;
  transition: background .12s ease, border-color .12s ease;
}
.cust-item:hover { background: var(--surface-alt); }
.cust-item.active { border-color: var(--brand); background: var(--surface-accent); }
.cust-item .name { font-weight: 600; }
.cust-item .email { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.cust-item .meta { color: var(--muted); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; margin-top: 4px; }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab {
  border: none; background: none; border-bottom: 2px solid transparent;
  border-radius: 0; padding: 12px 18px; color: var(--muted); font-weight: 600;
  font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; margin-bottom: -1px;
}
.tab:hover { background: none; color: var(--fg); opacity: 1; }
.tab.active { color: var(--brand); border-bottom-color: var(--brand); }

.form-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.form-row .field { margin-bottom: 0; flex: 1 1 160px; }
.field select {
  width: 100%; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 0; font: inherit; background: var(--bg); color: var(--fg);
}
.inline-form { border: 1px solid var(--soft); border-radius: 0; padding: 16px; margin-bottom: 18px; background: var(--surface-alt); }

.dork-q { font-family: inherit; font-size: 12.5px; overflow-wrap: anywhere; color: var(--brand-dark); }
.pill {
  display: inline-block; padding: 1px 8px; border-radius: 0; font-size: 10px;
  letter-spacing: 0.12em; text-transform: uppercase;
  border: 1px solid var(--line); color: var(--muted); margin-right: 6px;
}
.pill.on { color: var(--ok); border-color: var(--ok); }
.pill.off { color: var(--muted); }
.detail-empty { color: var(--muted); padding: 48px 0; text-align: center; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }

/* ---- screenshots ---- */
.shot-thumb {
  width: 96px; height: 60px; object-fit: cover; object-position: top;
  border: 1px solid var(--line); border-radius: 0; cursor: zoom-in;
  background: var(--surface-alt); display: block;
}
.shot-thumb:hover { border-color: var(--brand); }
.shot-none { display: inline-block; width: 96px; text-align: center; }

/* ---- screenshot viewer (shot.js) ----
   Full-page captures are tall and narrow; scaling them to fit the viewport
   makes the text unreadable. Show them at a readable width and scroll. */
.shot-viewer { align-items: stretch; justify-content: center; padding: 20px; }
.shot-frame {
  display: flex; flex-direction: column;
  width: min(1100px, 96vw); max-height: 96vh;
  background: var(--bg); border: 1px solid var(--line);
  box-shadow: var(--shadow-drawer);
}
.shot-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 12px; border-bottom: 1px solid var(--line);
  background: var(--surface-alt); flex: 0 0 auto;
}
.shot-cap {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); overflow-wrap: anywhere;
}
.shot-tools { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.shot-tools .shot-open { text-decoration: none; line-height: 1.2; }
.shot-zoom {
  min-width: 48px; text-align: center; font-size: 10px;
  letter-spacing: 0.08em; color: var(--muted);
}
/* The scroll container is the point of the whole thing. */
.shot-scroll {
  flex: 1 1 auto; overflow: auto; background: var(--surface-alt);
  outline: none; overscroll-behavior: contain;
}
.shot-img { display: block; width: 100%; height: auto; }
.lightbox-img {
  max-width: 92vw; max-height: 92vh;
  border: 2px solid var(--bg); border-radius: 0;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5); cursor: zoom-out;
}
.intel { font-size: 11px; color: var(--muted); margin-top: 4px; }
.intel code { background: var(--surface-alt); padding: 0 4px; border-radius: 0; font-family: inherit; }
