:root {
  --bg: #070708;
  --panel: rgba(15, 15, 17, 0.72);
  --panel-solid: #0f0f11;
  --raise: rgba(255, 255, 255, 0.035);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.18);
  --text: #e8e8ea;
  --muted: #8c8c93;
  --dim: #55555b;
  --accent: #f5f5f6;
  --inset: rgba(0, 0, 0, 0.45);
  --inset-2: rgba(0, 0, 0, 0.25);
  --radius: 14px;
  --font: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse 120% 70% at 50% -10%, #17171b 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 14px/1.55 var(--font);
  overflow-x: hidden;
}

#snow {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

a { color: var(--text); text-decoration-color: var(--dim); text-underline-offset: 3px; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }

::selection { background: #fff; color: #000; }

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: var(--font); }
.wrap { overflow-wrap: anywhere; word-break: break-word; }
.icon { display: inline-block; vertical-align: -2px; flex: none; }

/* ---------- app layout: sidebar + content ---------- */

.app { position: relative; z-index: 1; display: flex; min-height: 100vh; }

.side {
  position: sticky;
  top: 0;
  height: 100vh;
  flex: none;
  width: 224px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 10px 12px;
  background: var(--panel);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  overflow: hidden auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
  transition: width .18s ease;
}
.side-top { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 2px 2px 4px 6px; }
.brand { text-decoration: none; color: var(--accent); font-weight: 700; letter-spacing: -0.04em; font-size: 18px; white-space: nowrap; }
.brand-full span, .brand-mark span, .mobilebar .brand span { color: var(--dim); }
.brand-mark { display: none; }
.side-btns { display: flex; gap: 2px; }

.iconbtn {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
}
.iconbtn:hover { color: var(--text); background: var(--raise); border-color: var(--line); }

.palbtn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  font-size: 12.5px;
  text-align: left;
  color: var(--muted);
  background: var(--inset-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}
.palbtn:hover { color: var(--text); border-color: var(--line-strong); }
.palbtn .ico { display: grid; }
.palbtn kbd { margin-left: auto; font-size: 10px; color: var(--dim); }

#tabs { display: flex; flex-direction: column; gap: 2px; }
.navgroup { display: flex; flex-direction: column; }
.grouphead {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 9px 8px 4px 10px;
  font: inherit;
  color: var(--dim);
  background: none;
  border: 0;
  cursor: pointer;
}
.grouphead:hover { color: var(--muted); }
.navlabel { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.groupcount { font-size: 10px; opacity: 0; transition: opacity .15s; }
.navgroup.closed .groupcount, .grouphead:hover .groupcount { opacity: 1; }
.grouphead .chev { margin-left: auto; width: 12px; height: 12px; transform: rotate(90deg); transition: transform .18s ease; }
.navgroup.closed .grouphead .chev { transform: rotate(0deg); }
.groupitems { display: flex; flex-direction: column; gap: 1px; }
/* a collapsed group still shows the tool you are on */
.navgroup.closed .navitem:not([aria-current="page"]) { display: none; }

.navitem {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  font-size: 12.5px;
  white-space: nowrap;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 8px;
  transition: color .12s, background .12s;
}
.navitem .icon { opacity: .7; }
.navitem:hover { color: var(--text); background: var(--raise); }
.navitem:hover .icon, .navitem[aria-current="page"] .icon { opacity: 1; }
.navitem[aria-current="page"] { color: var(--accent); background: var(--raise); border-color: var(--line-strong); }
.side-foot { margin-top: auto; padding: 10px 10px 0; }

/* rail: the sidebar folds down to icons (desktop only) */
@media (min-width: 901px) {
  body.rail .side { width: 60px; padding-left: 8px; padding-right: 8px; }
  body.rail .navtext, body.rail .navlabel, body.rail .groupcount, body.rail .grouphead .chev,
  body.rail .brand-full, body.rail #groupsToggle { display: none; }
  body.rail .brand-mark { display: inline; }
  body.rail .side-top { flex-direction: column; gap: 8px; padding: 2px 0 4px; }
  body.rail .grouphead { padding: 7px 4px; pointer-events: none; }
  body.rail .grouphead::before { content: ''; display: block; flex: 1; height: 1px; background: var(--line); }
  body.rail .navgroup.closed .navitem { display: flex; }
  body.rail .navitem, body.rail .palbtn { justify-content: center; padding: 8px 0; }
}

.content { flex: 1; min-width: 0; }
main { max-width: 1060px; margin: 0 auto; padding: 26px 24px 40px; }
.mobilebar, .scrim { display: none; }

/* tool header */
.toolhead { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.th-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  color: var(--accent);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 11px;
}
.th-icon .icon { width: 20px; height: 20px; }
.th-text { flex: 1; min-width: 0; }
.th-crumb { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; }
.th-text h2 { margin: 1px 0 3px; font-size: 20px; font-weight: 700; letter-spacing: -0.02em; color: var(--accent); }
.th-text p { margin: 0; font-size: 12.5px; max-width: 72ch; }
.th-actions { display: flex; gap: 2px; flex: none; padding-top: 2px; }

@media (max-width: 900px) {
  .side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 40;
    width: 252px;
    background: var(--panel-solid);
    transform: translateX(-102%);
    transition: transform .2s ease;
  }
  body.drawer .side { transform: none; box-shadow: 0 0 50px rgba(0, 0, 0, 0.5); }
  #railToggle { display: none; }
  .scrim {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 30;
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s;
  }
  body.drawer .scrim { opacity: 1; pointer-events: auto; }
  .mobilebar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 9px 12px;
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
  }
  main { padding: 16px 16px 32px; }
  .toolhead { flex-wrap: wrap; gap: 10px 12px; }
  .th-actions { width: 100%; padding-top: 0; }
}

/* ---------- search panel ---------- */

.panel, .card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.panel { padding: 10px; }

#search { display: flex; gap: 8px; }

input, button { font: inherit; }

#q, .filter, .field input {
  width: 100%;
  min-width: 0;
  color: var(--text);
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
#q { flex: 1; font-size: 15px; }
#q::placeholder, .filter::placeholder, .field input::placeholder { color: var(--dim); }
#q:focus, .filter:focus, .field input:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.05); }

#search button[type="submit"] {
  flex: none;
  color: #050505;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  padding: 0 20px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
}
#search button[type="submit"]:hover { opacity: .88; }
#search button[type="submit"]:active { transform: scale(.97); }

.hint, .recent { font-size: 12px; padding: 0 4px; }
.hint:not(:empty) { margin-top: 8px; color: var(--muted); }
.recent:not(:empty) { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }

button.mini {
  color: var(--muted);
  background: var(--raise);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 3px 9px;
  font-size: 11px;
  cursor: pointer;
}
button.mini:hover { color: var(--text); border-color: var(--line-strong); }
button.mini.ghost { background: none; border-color: transparent; }

.chip {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  text-decoration: none;
  color: var(--muted);
  background: var(--raise);
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}
.chip:hover { color: var(--text); border-color: var(--line-strong); }

/* ---------- output ---------- */

#out { margin-top: 14px; }

.intro { color: var(--muted); text-align: center; padding: 6px 8px 18px; }
.intro p { margin: 0 0 10px; }
.examples { display: flex; gap: 6px; justify-content: flex-start; align-items: center; flex-wrap: wrap; margin: 0 0 14px; }

.error { color: var(--text); margin: 4px 0 12px; }
.error::before { content: '× '; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.card.wide { grid-column: 1 / -1; }

.card { padding: 14px 16px 16px; min-width: 0; animation: rise .35s ease both; }
.card > header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card h3 {
  margin: 0;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}
.card .actions { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px; font-size: 12px; text-align: right; }
.card p { margin: 0 0 8px; }
.card .body > p.muted:last-child { margin-bottom: 0; }

@keyframes rise { from { opacity: 0; transform: translateY(6px); } }

.loading { display: flex; align-items: center; gap: 10px; color: var(--muted); padding: 6px 0; }
#out > .loading { justify-content: center; padding: 20px; }

.spin {
  width: 13px;
  height: 13px;
  border: 1.5px solid var(--dim);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* key / value */
.kv { display: grid; grid-template-columns: minmax(90px, max-content) minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* dns table */
.records { width: 100%; border-collapse: collapse; }
.records td { padding: 5px 8px 5px 0; border-top: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.records tr:first-child td { border-top: 0; }
.records .type { color: var(--muted); width: 64px; }
.records .ttl { width: 64px; text-align: right; font-size: 12px; }

.pivot { text-decoration-style: dotted; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag, .tags > a {
  padding: 2px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--raise);
  font-size: 12px;
  text-decoration: none;
}

/* link groups */
.linkgroup + .linkgroup { margin-top: 12px; }
.linkgroup h4 { margin: 0 0 6px; font-size: 11px; font-weight: 500; color: var(--dim); letter-spacing: .08em; text-transform: uppercase; }
.links { display: flex; flex-wrap: wrap; gap: 6px; }
.links a {
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--raise);
  text-decoration: none;
  font-size: 12.5px;
  color: var(--text);
  transition: border-color .15s, background .15s;
}
.links a::after { content: ' ↗'; color: var(--dim); }
.links a:hover { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.07); }

/* username live checks */
.livelist { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.liverow {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--inset-2);
  min-width: 0;
}
.liverow.found { border-color: var(--line-strong); background: rgba(255, 255, 255, 0.04); }
.liverow.none { opacity: .55; }
.liverow .main { min-width: 0; flex: 1; }
.liverow .main > a { font-weight: 500; }
.liverow .detail { font-size: 12px; overflow-wrap: anywhere; margin-top: 2px; }
.avatar:empty { display: none; }
.avatar img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; display: block; background: #111; }
.liverow .badge { margin: 1px 0 0 8px; font-size: 10px; vertical-align: 1px; }

/* deep scan */
.scanopts { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin: 8px 0 10px; }
.scanopts label { display: inline-flex; align-items: center; gap: 6px; }
.scanbar { height: 4px; border-radius: 3px; background: var(--inset-2); overflow: hidden; margin-bottom: 12px; }
.scanbar .barfill { height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }

/* recon: stat tiles, data table, findings */
.statrow { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 10px 0 12px; }
.statrow4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 12px; }
.links.col { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; max-height: 420px; overflow: auto; }
.links.col a { font-size: 12px; overflow-wrap: anywhere; }
.statcell { border: 1px solid var(--line); border-radius: 10px; background: var(--inset-2); padding: 10px 8px; text-align: center; }
.statnum { font-size: 22px; font-weight: 600; line-height: 1; }
.statlbl { margin-top: 5px; }
.datatable { width: 100%; border-collapse: collapse; font-size: 13px; }
.datatable th { text-align: left; font-weight: 500; color: var(--dim); padding: 6px 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); }
.datatable td { padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.datatable td .badge { margin: 1px 3px 1px 0; }
.datatable tr:hover td { background: rgba(255, 255, 255, 0.03); }
.risklist { display: flex; flex-direction: column; gap: 6px; }
.riskrow { display: flex; align-items: flex-start; gap: 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 9px; background: var(--inset-2); font-size: 13px; }
.riskrow .badge { flex: none; margin-top: 1px; }
@media (max-width: 640px) { .statrow { grid-template-columns: repeat(3, 1fr); } .statrow4 { grid-template-columns: repeat(2, 1fr); } }

.dot { flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; }
.dot.pending { border: 1.5px solid var(--dim); border-top-color: var(--accent); animation: spin .7s linear infinite; width: 10px; height: 10px; margin-top: 5px; }
.dot.found { background: var(--accent); box-shadow: 0 0 10px rgba(255, 255, 255, 0.7); }
.dot.none { background: var(--dim); }
.dot.unknown { border: 1.5px solid var(--muted); }

/* subdomains */
.row { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.filter { padding: 8px 12px; }
.sublist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 2px 16px;
  max-height: 340px;
  overflow: auto;
  font-size: 12.5px;
}
.sublist a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* maps — OpenStreetMap tiles inverted into a dark monochrome map */
.map { margin: 12px 0 10px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); height: 240px; }
.map iframe { width: 100%; height: 100%; border: 0; filter: invert(.92) hue-rotate(180deg) grayscale(1) contrast(.9); }

/* images */
.preview { margin-bottom: 12px; }
.preview img { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; border: 1px solid var(--line); }
.gravatar img { width: 96px; height: 96px; border-radius: 12px; display: block; margin-bottom: 8px; }

.drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 26px 16px;
  margin-bottom: 14px;
  text-align: center;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: rgba(255, 255, 255, 0.05); }
.drop span { font-size: 12px; }

details { margin-top: 12px; }
summary { cursor: pointer; color: var(--muted); margin-bottom: 8px; }
summary:hover { color: var(--text); }

/* query builder */
.fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.field input { padding: 9px 12px; font-size: 13px; }
.query {
  display: block;
  padding: 12px 14px;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--inset);
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
  color: var(--accent);
}
.query + .links { margin-bottom: 12px; }

kbd { padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 5px; font: inherit; font-size: 11px; }

footer { margin-top: 36px; text-align: center; font-size: 12px; }
footer p { margin: 4px 0; }

@media (max-width: 680px) {
  .grid, .livelist, .fields { grid-template-columns: minmax(0, 1fr); }
  #search button[type="submit"] { padding: 0 14px; }
  .kv { grid-template-columns: minmax(80px, max-content) minmax(0, 1fr); gap: 6px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .card { animation: none; }
}

/* ---------- new components ---------- */

.badge {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--raise);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.badge.ok { color: #d8f0dc; border-color: rgba(120, 220, 150, 0.35); background: rgba(90, 200, 130, 0.1); }
.badge.warn { color: #f0e6c8; border-color: rgba(220, 190, 110, 0.35); background: rgba(210, 180, 90, 0.1); }
.badge.bad { color: #f2d4d4; border-color: rgba(230, 120, 120, 0.4); background: rgba(220, 90, 90, 0.12); }

.verdict {
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-weight: 500;
  margin-bottom: 10px;
}
.verdict.ok { color: #d8f0dc; border-color: rgba(120, 220, 150, 0.35); background: rgba(90, 200, 130, 0.08); }
.verdict.bad { color: #f2d4d4; border-color: rgba(230, 120, 120, 0.4); background: rgba(220, 90, 90, 0.1); }

.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.row.wrap { flex-wrap: wrap; }

/* detect banner (universal search) */
.detect {
  display: flex; flex-wrap: wrap; align-items: center; gap: 7px;
  padding: 9px 12px; margin-bottom: 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
}

/* all-in-one aggregated search */
.deepbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: -4px 0 4px; }
.chip.deep { border-color: var(--line-strong); color: var(--text); }
.aggsection { margin-top: 20px; }
.agghead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.agghead h3 { margin: 0; font-size: 13px; letter-spacing: .04em; text-transform: uppercase; color: var(--dim); }
.aggbody { min-height: 20px; }

/* list of records / breaches / news */
.breach-list { display: flex; flex-direction: column; gap: 8px; max-height: 420px; overflow: auto; }
.breach-item { padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--inset-2); }
.bi-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.breach-item .tags { margin-top: 5px; }

/* transactions */
.tx-list { display: flex; flex-direction: column; gap: 4px; }
.tx-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 0; border-top: 1px solid var(--line); }
.tx-item:first-child { border-top: 0; }

/* settings: api keys */
.keylist { display: flex; flex-direction: column; gap: 12px; margin-top: 10px; }
.keyrow { display: flex; flex-direction: column; gap: 6px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.keyrow:last-child { border-bottom: 0; padding-bottom: 0; }
.keymeta { line-height: 1.5; }
.keyrow .row { display: flex; gap: 6px; align-items: center; }
.keyrow .filter { flex: 1; }

.setrow { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.segset { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg { font: inherit; font-size: 12px; color: var(--muted); background: transparent; border: 0; padding: 5px 12px; cursor: pointer; }
.seg + .seg { border-left: 1px solid var(--line); }
.seg.on { color: var(--accent); background: var(--raise); }

/* utils output */
.util-out { margin-bottom: 8px; }
.util-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 3px; font-size: 12px; }
pre.json { margin: 0; padding: 8px 10px; background: var(--inset); border: 1px solid var(--line); border-radius: 8px; overflow: auto; font-size: 12px; max-height: 240px; }

/* graph */
.graphwrap { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--inset-2); margin-bottom: 8px; }
.graphcanvas { display: block; width: 100%; height: min(70vh, 620px); touch-action: none; }

/* ---------- light theme ---------- */

:root[data-theme="light"] {
  --bg: #f4f4f6;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-solid: #ffffff;
  --raise: rgba(0, 0, 0, 0.03);
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: rgba(0, 0, 0, 0.26);
  --text: #16161a;
  --muted: #5c5c66;
  --dim: #9a9aa4;
  --accent: #0b0b0d;
  --inset: rgba(0, 0, 0, 0.05);
  --inset-2: rgba(0, 0, 0, 0.03);
  color-scheme: light;
}
:root[data-theme="light"] body {
  background: radial-gradient(ellipse 120% 70% at 50% -10%, #ffffff 0%, var(--bg) 60%) fixed, var(--bg);
}
/* flakes are drawn white; invert to dark specks on a light background */
:root[data-theme="light"] #snow { filter: invert(1); opacity: 0.4; }
:root[data-theme="light"] ::selection { background: #111; color: #fff; }
:root[data-theme="light"] #search button[type="submit"] { color: #fff; }
:root[data-theme="light"] .map iframe { filter: grayscale(1) contrast(.95); }

/* ---------- collapsible cards ---------- */

.cardtoggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  margin: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  text-align: left;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}
.cardtoggle:hover { color: var(--text); }
.cardtoggle .chev { width: 12px; height: 12px; opacity: .6; transform: rotate(90deg); transition: transform .15s ease; }
.card.collapsed .cardtoggle .chev { transform: rotate(0deg); }
.card.collapsed > .body { display: none; }
.card.collapsed > header { margin-bottom: 0; }
.card.collapsed { padding-bottom: 14px; }

/* ---------- home launcher ---------- */

.launcher { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 12px; }
.lgroup {
  padding: 12px 10px 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: rise .35s ease both;
}
.lgroup h4 { margin: 0 0 6px 6px; font-size: 10px; font-weight: 500; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.ltool { display: flex; align-items: flex-start; gap: 10px; padding: 7px 6px; border-radius: 8px; text-decoration: none; }
.ltool:hover { background: var(--raise); }
.lt-icon { flex: none; display: grid; place-items: center; width: 28px; height: 28px; color: var(--accent); border: 1px solid var(--line); border-radius: 8px; }
.lt-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.lt-text strong { font-size: 12.5px; font-weight: 500; color: var(--text); }

/* ---------- command palette ---------- */

.palette {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 12vh 16px 16px;
  background: rgba(0, 0, 0, 0.45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}
.palette[hidden] { display: none; }
.palbox {
  width: min(580px, 100%);
  overflow: hidden;
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
#palinput {
  width: 100%;
  padding: 15px 16px;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--line);
  outline: none;
}
#palinput::placeholder { color: var(--dim); }
.pallist { max-height: 52vh; overflow: auto; padding: 6px; }
.palitem { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; text-decoration: none; color: var(--text); }
.palitem.on { background: var(--raise); box-shadow: inset 0 0 0 1px var(--line-strong); }
.pi-icon { display: grid; color: var(--muted); }
.pi-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pi-hint { flex: none; }
.palfoot { padding: 8px 14px; border-top: 1px solid var(--line); }
.pal-empty { padding: 10px; margin: 0; }

/* ---------- text inputs ---------- */

textarea.bigtext {
  display: block;
  width: 100%;
  min-height: 150px;
  margin-bottom: 8px;
  padding: 12px 14px;
  font: 12.5px/1.55 var(--font);
  color: var(--text);
  background: var(--inset);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  resize: vertical;
}
textarea.bigtext:focus { border-color: var(--line-strong); }
textarea.bigtext::placeholder { color: var(--dim); }
.casetitle { margin-bottom: 8px; font-size: 15px; font-weight: 500; }

/* ---------- findings, hops, timeline ---------- */

.findings { display: flex; flex-direction: column; gap: 7px; }
.finding { display: flex; align-items: baseline; gap: 10px; }
.finding .badge { flex: none; }

ol.hops { margin: 0; padding: 0 0 0 8px; list-style: none; counter-reset: hop; }
ol.hops li { position: relative; padding: 0 0 13px 22px; border-left: 1px solid var(--line); counter-increment: hop; }
ol.hops li:last-child { padding-bottom: 0; border-left-color: transparent; }
ol.hops li::before {
  content: counter(hop);
  position: absolute;
  left: -9px;
  top: 0;
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  font-size: 10px;
  color: var(--muted);
  background: var(--panel-solid);
  border: 1px solid var(--line-strong);
  border-radius: 50%;
}
.hop-head { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }

ol.timeline { margin: 0; padding: 0; list-style: none; }
ol.timeline li { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 5px 0; border-top: 1px solid var(--line); }
ol.timeline li:first-child { border-top: 0; }

.strings { max-height: 360px; overflow: auto; margin-top: 8px; padding: 8px 10px; background: var(--inset); border: 1px solid var(--line); border-radius: 8px; }

/* ---------- maps ---------- */

.leafbox { margin-bottom: 8px; overflow: hidden; background: var(--inset-2); border: 1px solid var(--line); border-radius: 10px; }
.leafbox > .loading { padding: 16px; }
.leaflet-container { background: var(--inset-2) !important; font-family: var(--font) !important; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  color: var(--text) !important;
  background: var(--panel-solid) !important;
  border: 1px solid var(--line-strong);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4) !important;
}
.leaflet-popup-content { margin: 10px 12px !important; font-size: 12px; line-height: 1.55; }
.leaflet-container a.leaflet-popup-close-button { color: var(--muted); }
.leaflet-bar a { color: var(--text) !important; background: var(--panel-solid) !important; border-color: var(--line) !important; }
.leaflet-control-attribution { color: var(--muted) !important; background: rgba(0, 0, 0, 0.55) !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
:root[data-theme="light"] .leaflet-control-attribution { background: rgba(255, 255, 255, 0.75) !important; }
path.arc { stroke-dasharray: 3 7; animation: flow 1.6s linear infinite; }
path.arc-dash { stroke-dasharray: 2 5; }
@keyframes flow { to { stroke-dashoffset: -20; } }

.maplist { display: flex; flex-direction: column; }
.maprow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 6px; border-top: 1px solid var(--line); border-radius: 6px; cursor: pointer; }
.maprow:first-child { border-top: 0; }
.maprow:hover, .maprow.hot { background: var(--raise); }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.lg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.lg-dot.dim { opacity: .45; }
.lg-line { display: inline-block; width: 18px; vertical-align: middle; border-top: 1.5px solid var(--accent); }
.lg-line.dash { border-top-style: dashed; }

/* urlscan thumbnails */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.shots a { display: flex; flex-direction: column; gap: 4px; padding: 6px; text-decoration: none; background: var(--inset-2); border: 1px solid var(--line); border-radius: 9px; }
.shots a:hover { border-color: var(--line-strong); }
.shots img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top; border-radius: 6px; background: #111; }

/* ---------- case file ---------- */

.casegroup + .casegroup { margin-top: 12px; }
.casegroup h4 { margin: 0 0 6px; font-size: 11px; font-weight: 500; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.casechips { display: flex; flex-wrap: wrap; gap: 6px; }
.casechip { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 2px 4px 2px 10px; font-size: 12px; background: var(--raise); border: 1px solid var(--line); border-radius: 999px; }
.casechip a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chipx { padding: 0 5px; font-size: 14px; line-height: 1; color: var(--dim); background: none; border: 0; cursor: pointer; }
.chipx:hover { color: var(--text); }

@media (prefers-reduced-motion: reduce) {
  path.arc { animation: none; }
  .lgroup { animation: none; }
}

/* ---------- print (case reports) ---------- */

@media print {
  #snow, .side, .scrim, .mobilebar, .panel, .th-actions, footer, .card .actions, .palette, .cardtoggle .chev { display: none !important; }
  body { color: #000; background: #fff !important; }
  .app { display: block; }
  main { max-width: none; padding: 0; }
  .card, .th-icon { color: #000; background: #fff; border-color: #ccc; backdrop-filter: none; animation: none; break-inside: avoid; }
  .card.collapsed > .body { display: block; }
  a { color: #000; }
}

/* raw JSON disclosure */
.rawbox { margin-top: 10px; }
.rawbox > summary { display: flex; align-items: center; gap: 8px; }
.rawbox pre.json { margin-top: 8px; max-height: 420px; }

/* ---------- auth / account ---------- */

.authtoggle { display: inline-flex; margin: 10px 0 12px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.authform { display: flex; flex-direction: column; gap: 10px; max-width: 340px; margin-top: 10px; }
.authform .field { gap: 5px; }
.authform .field input { padding: 10px 12px; font-size: 13px; }
button.primary {
  font: inherit; font-size: 13px; font-weight: 600; color: #050505;
  background: var(--accent); border: 0; border-radius: 9px; padding: 9px 16px; cursor: pointer; align-self: flex-start;
}
button.primary:hover { opacity: .9; }
button.primary:disabled { opacity: .5; cursor: default; }
.authform button:not(.primary), .rawbox button {
  font: inherit; font-size: 12px; color: var(--muted); background: var(--raise);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 14px; cursor: pointer; align-self: flex-start;
}
.authform .verdict { margin: 2px 0 0; }
.qrbox { width: max-content; margin: 8px 0; padding: 10px; background: #fff; border-radius: 10px; }
.qrbox svg { display: block; width: 200px; height: 200px; }
.qrbox.loading { background: var(--inset-2); color: var(--muted); padding: 40px; }
:root[data-theme="light"] button.primary { color: #fff; }

/* ---------- AI chat ---------- */

.chatwrap { position: relative; display: flex; flex-direction: column; gap: 10px; }

.pinstrip { display: none; }
.pinstrip.on { display: block; padding: 8px 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.pinhead { display: flex; align-items: center; gap: 5px; margin-bottom: 6px; }
.pinhead .ico svg { width: 12px; height: 12px; }
.pinitems { display: flex; flex-wrap: wrap; gap: 6px; }
.pinchip { font: inherit; font-size: 11.5px; color: var(--muted); background: var(--raise); border: 1px solid var(--line); border-radius: 7px; padding: 4px 9px; cursor: pointer; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pinchip:hover { color: var(--text); border-color: var(--line-strong); }

.chatlog {
  display: flex; flex-direction: column; gap: 16px;
  min-height: 340px; max-height: 62vh; overflow-y: auto;
  padding: 18px 16px; scroll-behavior: smooth;
  background: radial-gradient(130% 80% at 50% 0%, rgba(255,255,255,0.025), transparent 60%), var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius);
}

.msg { display: flex; gap: 11px; max-width: 100%; animation: rise .25s ease both; }
.msg.user { flex-direction: row-reverse; }
.msg-av { flex: none; width: 30px; height: 30px; border-radius: 9px; overflow: hidden; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--inset-2); border: 1px solid var(--line); }
.msg-av svg { width: 100%; height: 100%; display: block; }
.msg-av img { width: 100%; height: 100%; object-fit: cover; }
.msg-main { min-width: 0; max-width: 82%; display: flex; flex-direction: column; gap: 5px; }
.msg.user .msg-main { align-items: flex-end; }

.bubble { position: relative; padding: 10px 14px; border-radius: 14px; }
.msg.assistant .bubble { background: var(--inset-2); border: 1px solid var(--line); border-top-left-radius: 4px; }
.msg.user .bubble { background: var(--accent); color: #070708; border-top-right-radius: 4px; }
.msg.user .bubble .plain { white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.user .bubble a { color: #070708; }

.msgtools { position: absolute; top: -12px; display: flex; gap: 2px; padding: 2px; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 8px; opacity: 0; transition: opacity .12s; pointer-events: none; }
.msg.assistant .msgtools { right: 8px; }
.msg.user .msgtools { left: 8px; }
.msg:hover .msgtools, .msgtools:focus-within { opacity: 1; pointer-events: auto; }
.msgbtn { display: grid; place-items: center; width: 24px; height: 24px; padding: 0; color: var(--muted); background: none; border: 0; border-radius: 6px; cursor: pointer; }
.msgbtn svg { width: 14px; height: 14px; }
.msgbtn:hover { color: var(--text); background: var(--raise); }
.msgbtn.active { color: var(--accent); }

.flashmsg .bubble { box-shadow: 0 0 0 2px var(--line-strong); }

.typing { display: inline-flex; gap: 4px; padding: 3px 2px; }
.typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite ease-in-out both; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.chipflow { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.msg.user .chipflow { justify-content: flex-end; }

.chatempty { display: flex; flex-direction: column; gap: 14px; margin: auto 0; padding: 10px; }
.welcome { display: flex; gap: 12px; align-items: flex-start; }
.welcome-av { flex: none; width: 40px; height: 40px; border-radius: 11px; overflow: hidden; }
.welcome-av svg { width: 100%; height: 100%; }
.welcome strong { display: block; margin-bottom: 3px; }
.suggchip { font: inherit; font-size: 12.5px; color: var(--text); background: var(--raise); border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer; }
.suggchip:hover { border-color: var(--line-strong); background: rgba(255,255,255,0.06); }

/* bar */
.chatbar { position: relative; display: flex; flex-direction: column; gap: 8px; }
.barrow { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.barleft { position: relative; display: flex; gap: 6px; }
.barbtn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; color: var(--muted); background: var(--raise); border: 1px solid var(--line); border-radius: 9px; padding: 6px 11px; cursor: pointer; }
.barbtn svg { width: 15px; height: 15px; }
.barbtn:hover { color: var(--text); border-color: var(--line-strong); }
.barbtn.on { color: var(--accent); border-color: var(--line-strong); }

.inputrow { display: flex; gap: 8px; align-items: flex-end; }
.chatinput {
  flex: 1; resize: none; min-height: 46px; max-height: 180px; overflow-y: auto;
  padding: 12px 14px; font: 13px/1.5 var(--font); color: var(--text);
  background: var(--inset); border: 1px solid var(--line); border-radius: 13px; outline: none;
}
.chatinput:focus { border-color: var(--line-strong); box-shadow: 0 0 0 3px rgba(255,255,255,0.05); }
.sendbtn { display: inline-flex; align-items: center; gap: 6px; align-self: stretch; padding: 0 16px; }
.sendbtn svg { width: 15px; height: 15px; }

/* actions popover */
.actionmenu { position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 30; width: min(380px, 88vw); max-height: 60vh; overflow-y: auto; padding: 10px; background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 13px; box-shadow: 0 16px 48px rgba(0,0,0,0.5); display: none; }
.actionmenu.open { display: block; animation: rise .15s ease both; }
.actgroup + .actgroup { margin-top: 8px; }
.acthead { letter-spacing: .1em; text-transform: uppercase; margin: 4px 4px 5px; }
.actitems { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.actitem { display: flex; align-items: center; gap: 8px; font: inherit; font-size: 12px; color: var(--text); background: none; border: 1px solid transparent; border-radius: 8px; padding: 7px 9px; cursor: pointer; text-align: left; }
.actitem svg { width: 15px; height: 15px; color: var(--muted); flex: none; }
.actitem:hover { background: var(--raise); border-color: var(--line); }
.actitem:hover svg { color: var(--accent); }

.chattoast { position: absolute; bottom: 70px; left: 50%; transform: translateX(-50%) translateY(8px); padding: 7px 14px; font-size: 12px; color: var(--text); background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 999px; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; }
.chattoast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 680px) { .actitems { grid-template-columns: 1fr; } .msg-main { max-width: 88%; } }

/* ---------- autonomous engine ---------- */

.enginelog { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; max-height: 300px; overflow-y: auto; }
.enginelog .step { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; padding: 3px 0; border-top: 1px solid var(--line); }
.enginelog .step:first-child { border-top: 0; }
.enginelog .step .badge { flex: none; }
.enginelog .step span { overflow-wrap: anywhere; }

/* ---------- account / github ---------- */
.ghbtn { display: inline-flex; align-items: center; gap: 8px; }
.ghbtn .icon { width: 17px; height: 17px; }
.profile { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.avatar-lg { width: 48px; height: 48px; border-radius: 10px; object-fit: cover; background: var(--inset-2); }
.admintable td { vertical-align: middle; }
.admintable .row { gap: 6px; flex-wrap: wrap; }

/* chat: streaming thoughts + stop + busy indicator */
.thoughts { margin-bottom: 8px; border: 1px solid var(--line); border-radius: 9px; background: var(--inset); overflow: hidden; }
.thoughts > summary { display: flex; align-items: center; gap: 6px; padding: 7px 10px; cursor: pointer; list-style: none; }
.thoughts > summary::-webkit-details-marker { display: none; }
.thoughts .ico svg { width: 13px; height: 13px; color: var(--muted); }
.thoughts.live > summary span:last-child { animation: pulse 1.4s ease-in-out infinite; }
.thoughttext { padding: 0 11px 10px; font-size: 12px; line-height: 1.5; color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; max-height: 240px; overflow-y: auto; }
@keyframes pulse { 50% { opacity: .5; } }

.streamfoot { margin-top: 8px; }
.stopbtn { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 11.5px; color: var(--muted); background: var(--panel-solid); border: 1px solid var(--line-strong); border-radius: 8px; padding: 4px 11px; cursor: pointer; }
.stopbtn:hover { color: var(--text); }
.stopbtn .ico svg { width: 12px; height: 12px; }
.bubble.streaming { border-color: var(--line-strong); }

/* a running request shows a pulsing dot on the chat nav item */
.navitem.busy { position: relative; }
.navitem.busy::after { content: ''; position: absolute; right: 8px; top: 50%; width: 7px; height: 7px; margin-top: -3px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: pulse 1.1s ease-in-out infinite; }
body.rail .navitem.busy::after { right: 6px; top: 8px; margin-top: 0; }

/* ---------- sign-in wall ---------- */
body.locked .app, body.locked .palette { display: none; }
.lock { position: relative; z-index: 1; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.lock[hidden] { display: none; }
.lockbox { width: 100%; max-width: 420px; padding: 26px 24px 22px; }
.lockbox h2 { margin: 14px 0 6px; font-size: 18px; }
.lockbox p { margin: 0 0 10px; }
.lockbrand { font-weight: 700; font-size: 15px; letter-spacing: .02em; }
.lockbrand span { color: var(--muted); }
.lockactions { margin: 16px 0 12px; gap: 8px; align-items: center; }

/* ---------- chip wrap (wayback hosts / parameters, monitor lists) ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.statnum.warn { color: #e6a23c; }

/* ---------- step logs (playbook, monitor history) ---------- */
.steplog { max-height: 340px; overflow-y: auto; margin-top: 8px; }
.steplog .step { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; padding: 4px 0; border-top: 1px solid var(--line); }
.steplog .step:first-child { border-top: 0; }
.steplog .step .badge { flex: none; }
.steplog .step span { overflow-wrap: anywhere; }

.notespre { white-space: pre-wrap; font: inherit; margin: 0; color: var(--text); }
