/* =========================================================================
   MISP Feed Explorer

   Palette note: TLP and PAP taxonomies use red / amber / green as *data*.
   The chrome therefore stays out of those hues entirely and accents with
   periwinkle, so nothing in the interface can be mistaken for a marking.
   ========================================================================= */

/* -------------------------------------------------------------------------
   Self-hosted fonts. No third-party request is made from this page at all,
   which is what lets the offline shell be genuinely offline and keeps a
   security tool from phoning anywhere on load.
   ------------------------------------------------------------------------- */

@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: italic; font-weight: 400; font-display: swap; src: url('fonts/ibm-plex-sans-latin-400-italic.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Sans'; font-style: normal; font-weight: 700; font-display: swap; src: url('fonts/ibm-plex-sans-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 400; font-display: swap; src: url('fonts/ibm-plex-mono-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 500; font-display: swap; src: url('fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-weight: 600; font-display: swap; src: url('fonts/ibm-plex-mono-latin-600-normal.woff2') format('woff2'); }

:root {
  --ink:        #0E1119;
  --ink-2:      #141926;
  --ink-3:      #1B2231;
  --ink-4:      #232C3E;
  --line:       #2A3446;
  --line-soft:  #202839;

  --paper:      #E6EAF3;
  --haze:       #8C98B2;
  --haze-dim:   #626E86;

  --accent:        #7C8CFF;
  --accent-bright: #A2AEFF;
  --accent-dim:    #333C6B;
  --accent-wash:   rgba(124, 140, 255, 0.12);

  /* Semantic only — these belong to the data, not the chrome. */
  --tone-red:   #E5484D;
  --tone-amber: #F5A524;
  --tone-green: #46A758;
  --tone-white: #DCE3F0;
  --tone-grey:  #6B7690;

  --node-object:    #4CC2C4;
  --node-attribute: #8C98B2;
  --node-cluster:   #C77DFF;
  --node-tag:       #6B7690;

  --radius: 4px;
  --radius-lg: 6px;

  --sans: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, "SF Mono", "Cascadia Mono", Menlo, monospace;

  --chrome-h: 56px;
  --ledger-w: 300px;
  --shell-max: 1720px;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}

body.modal-open { overflow: hidden; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -0.011em; }
p { margin: 0; }
ul, ol, dl, dd { margin: 0; padding: 0; }
li { list-style: none; }

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

code, pre, .uuid, .mono { font-family: var(--mono); }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: var(--ink);
  padding: 10px 16px; font-weight: 600;
}
.skip-link:focus { left: 8px; top: 8px; }

.muted { color: var(--haze); }
.small { font-size: 13px; }
.sep { color: var(--haze-dim); margin: 0 6px; }

.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--haze-dim);
  font-weight: 500;
}

.inline-code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--ink-3);
  border: 1px solid var(--line-soft);
  border-radius: 3px;
  padding: 1px 5px;
  color: var(--paper);
}

/* ------------------------------------------------------------- chrome ---- */

.chrome {
  position: sticky; top: 0; z-index: 40;
  height: var(--chrome-h);
  display: flex; align-items: center; gap: 20px;
  padding: 0 clamp(14px, 3vw, 28px);
  background: rgba(14, 17, 25, 0.92);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--paper); }
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 18px; height: 18px;
  background:
    linear-gradient(135deg, var(--accent) 0 48%, transparent 48%),
    linear-gradient(315deg, var(--accent-dim) 0 48%, transparent 48%);
  border: 1px solid var(--accent);
}

.brand-text { display: flex; gap: 6px; align-items: baseline; font-size: 14px; }
.brand-text strong { letter-spacing: 0.06em; }
.brand-text span { color: var(--haze); }

.chrome-nav { display: flex; gap: 4px; margin-left: auto; }

.nav-link {
  color: var(--haze); font-size: 13.5px;
  padding: 6px 12px; border-radius: var(--radius);
}
.nav-link:hover { color: var(--paper); background: var(--ink-3); text-decoration: none; }
.nav-link.is-on { color: var(--paper); background: var(--ink-3); }

.misp-status {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--haze);
  font-family: var(--mono);
  white-space: nowrap;
}
.misp-status:hover { border-color: var(--accent-dim); color: var(--paper); text-decoration: none; }

.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--haze-dim);
  box-shadow: 0 0 0 3px rgba(107, 118, 144, 0.15);
}
.misp-status.is-live .status-dot {
  background: var(--tone-green);
  box-shadow: 0 0 0 3px rgba(70, 167, 88, 0.18);
}

.chrome-foot {
  margin-top: auto;
  padding: 18px clamp(14px, 3vw, 28px);
  border-top: 1px solid var(--line-soft);
  color: var(--haze-dim);
  font-size: 12px;
  display: flex; flex-wrap: wrap; gap: 4px;
}

.outlet {
  flex: 1;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  padding: clamp(20px, 3vw, 36px) clamp(14px, 3vw, 28px) 48px;
}
.outlet:focus { outline: none; }

/* -------------------------------------------------------------- buttons -- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px;
  font: inherit; font-size: 14px; font-weight: 500;
  color: var(--paper);
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--ink-4); border-color: var(--accent-dim); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--accent); border-color: var(--accent); color: #10131C; font-weight: 600; }
.btn-primary:hover:not(:disabled) { background: var(--accent-bright); border-color: var(--accent-bright); }

.btn-ghost { background: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--ink-3); }

.btn-danger { color: var(--tone-red); border-color: rgba(229, 72, 77, 0.4); background: transparent; }
.btn-danger:hover:not(:disabled) { background: rgba(229, 72, 77, 0.1); border-color: var(--tone-red); }

.btn-sm { padding: 6px 11px; font-size: 13px; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  font: inherit; font-size: 15px; line-height: 1;
  color: var(--haze);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--radius);
  cursor: pointer;
}
.icon-btn:hover { color: var(--paper); background: var(--ink-3); border-color: var(--line); }

.link-btn {
  font: inherit; font-size: 12.5px;
  color: var(--accent-bright);
  background: none; border: none; padding: 0;
  cursor: pointer;
}
.link-btn:hover { text-decoration: underline; text-underline-offset: 3px; }

.cta-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }

/* --------------------------------------------------------------- fields -- */

.field {
  width: 100%;
  padding: 9px 12px;
  font: inherit; font-size: 14px;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.field::placeholder { color: var(--haze-dim); }
.field:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-wash); }

select.field {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--haze) 50%), linear-gradient(135deg, var(--haze) 50%, transparent 50%);
  background-position: calc(100% - 16px) calc(50% + 2px), calc(100% - 11px) calc(50% + 2px);
  background-size: 5px 5px;
  background-repeat: no-repeat;
  padding-right: 32px;
}

.field-sm { padding: 7px 10px; font-size: 13px; width: auto; }
textarea.field { font-family: var(--mono); font-size: 13px; resize: vertical; }

.field-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.field-label { font-size: 13px; font-weight: 500; color: var(--paper); }
.field-hint { font-size: 12.5px; color: var(--haze-dim); }
.field-grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }

.checkline { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; flex-wrap: wrap; }
.checkline input { accent-color: var(--accent); width: 15px; height: 15px; }
.checkline .field-hint { flex-basis: 100%; margin-left: 24px; }
.checkline-inline { font-size: 13px; color: var(--haze); white-space: nowrap; }

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

.hero { max-width: 860px; padding-block: clamp(16px, 4vw, 44px); }

.hero-title {
  font-size: clamp(28px, 4.6vw, 46px);
  line-height: 1.1;
  letter-spacing: -0.028em;
  margin: 10px 0 16px;
  max-width: 16ch;
}
.hero-title em { font-style: normal; color: var(--accent-bright); }

.hero-copy { color: var(--haze); max-width: 66ch; font-size: 15.5px; }

.prompt {
  display: flex; align-items: stretch;
  margin: 28px 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--ink-2);
  overflow: hidden;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.prompt:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }

.prompt-sigil {
  display: flex; align-items: center; padding: 0 14px;
  color: var(--accent);
  font-size: 15px;
  border-right: 1px solid var(--line-soft);
}

.prompt-input {
  flex: 1; min-width: 0;
  padding: 15px 14px;
  font-family: var(--mono); font-size: 14.5px;
  color: var(--paper);
  background: transparent;
  border: none; outline: none;
}
.prompt-input::placeholder { color: var(--haze-dim); }

.prompt-go {
  padding: 0 22px;
  font: inherit; font-size: 14px; font-weight: 600;
  color: #10131C;
  background: var(--accent);
  border: none; cursor: pointer;
}
.prompt-go:hover { background: var(--accent-bright); }

.prompt-kind { display: flex; gap: 18px; margin-bottom: 34px; }
.kind-option { display: flex; align-items: center; gap: 7px; font-size: 13px; color: var(--haze); cursor: pointer; }
.kind-option input { accent-color: var(--accent); }

.known-feeds { margin-top: 30px; display: flex; flex-direction: column; gap: 22px; }
.feed-group { min-width: 0; }
.feed-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }

.feed-chip {
  display: flex; flex-direction: column; gap: 2px;
  padding: 11px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--ink-2);
  color: var(--paper);
  font-size: 13.5px;
}
.feed-chip:hover { border-color: var(--accent-dim); background: var(--ink-3); text-decoration: none; }
.feed-chip span { color: var(--haze-dim); font-size: 12px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-head h2 { font-size: 17px; }

.setup, .recent, .howto, .linking, .capabilities { margin-top: 52px; }

.recent-list { display: flex; flex-direction: column; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }

.recent-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 16px;
  padding: 12px 15px;
  background: var(--ink-2);
  color: var(--paper);
}
.recent-row:hover { background: var(--ink-3); text-decoration: none; }
.recent-label { font-weight: 500; font-size: 14px; }
.recent-count { color: var(--haze-dim); font-size: 12.5px; font-family: var(--mono); }
.recent-url { grid-column: 1 / -1; color: var(--haze-dim); font-family: var(--mono); font-size: 11.5px; overflow-wrap: anywhere; }

.recent-when { color: var(--haze-dim); font-size: 12px; }

/* -------------------------------------------------------------- setup ---- */
/* Two rows, because two things decide whether anything works: can we read the
   feed, and can we write to MISP. Everything else is detail. */

.setup-list { display: flex; flex-direction: column; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }

.setup-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: start;
  padding: 15px 16px;
  background: var(--ink-2);
}
.setup-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--haze-dim); box-shadow: 0 0 0 3px rgba(140, 152, 178, 0.12); }
.setup-row[data-state='ok'] .setup-dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.setup-text { min-width: 0; }
.setup-title { font-size: 14px; font-weight: 500; }
.setup-body { color: var(--haze); font-size: 13px; margin-top: 4px; }

/* --------------------------------------------------------------- steps --- */

.steps { display: flex; flex-direction: column; gap: 2px; counter-reset: step; list-style: none; }

.step {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 16px;
  padding: 18px 16px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--ink-2);
}
.step-n {
  display: grid; place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--accent-dim);
  color: var(--accent-bright);
  font-family: var(--mono); font-size: 13px;
}
.step-body h3 { font-size: 14.5px; margin-bottom: 6px; }
.step-body p { color: var(--haze); font-size: 13.5px; }
.howto .notice { margin-top: 18px; margin-bottom: 0; }

/* -------------------------------------------------------- link builder --- */

.built { display: flex; flex-direction: column; gap: 1px; margin: 18px 0 12px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }

.built-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px 15px;
  background: var(--ink-2);
}
.built-label { color: var(--haze-dim); font-size: 12.5px; }
.built-link { font-family: var(--mono); font-size: 12.5px; color: var(--accent-bright); overflow-wrap: anywhere; }

.capabilities { display: grid; gap: 1px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }
.capability { padding: 20px; background: var(--ink-2); }
.capability h3 { font-size: 14px; margin-bottom: 7px; }
.capability p { color: var(--haze); font-size: 13.5px; }

/* -------------------------------------------------------------- feed pg -- */

.feed-topline {
  display: flex; flex-wrap: wrap; gap: 16px;
  align-items: flex-end; justify-content: space-between;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.feed-title { font-size: clamp(20px, 2.6vw, 27px); letter-spacing: -0.02em; margin-top: 4px; }
.feed-path { font-family: var(--mono); font-size: 12px; color: var(--haze-dim); overflow-wrap: anywhere; margin-top: 5px; }
.feed-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.feed-body { display: grid; grid-template-columns: var(--ledger-w) minmax(0, 1fr); gap: 28px; margin-top: 22px; align-items: start; }

/* Grid and flex children default to min-width:auto, which lets a wide indicator
   table or a long feed URL push the whole column past the viewport. */
.feed-main, .view-host { min-width: 0; }
.feed-ident { min-width: 0; flex: 1 1 320px; }

/* ------------------------------------------------------------- ledger ---- */
/* The signature element: MISP's own tag structure, rendered as a ledger. */

.ledger {
  position: sticky; top: calc(var(--chrome-h) + 18px);
  max-height: calc(100dvh - var(--chrome-h) - 36px);
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.ledger::-webkit-scrollbar { width: 8px; }
.ledger::-webkit-scrollbar-thumb { background: var(--line); border-radius: 4px; }

.ledger-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ledger-close { display: none; }

.ledger-search { margin-bottom: 14px; font-family: var(--mono); font-size: 13px; }

.ledger-active { padding: 10px 0 14px; border-bottom: 1px solid var(--line-soft); margin-bottom: 6px; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }

.ledger-section { border-bottom: 1px solid var(--line-soft); }

.ledger-section > summary {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 2px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.ledger-section > summary::-webkit-details-marker { display: none; }
.ledger-section > summary::after {
  content: '+';
  margin-left: auto;
  color: var(--haze-dim);
  font-family: var(--mono);
  font-size: 14px;
}
.ledger-section[open] > summary::after { content: '−'; }
.ledger-section > summary:hover .sec-title { color: var(--accent-bright); }

.sec-kind {
  font-family: var(--mono); font-size: 9.5px;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--haze-dim);
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 1px 4px;
}
.sec-galaxy > summary .sec-kind { color: var(--node-cluster); border-color: rgba(199, 125, 255, 0.35); }

.sec-title { font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.sec-count { font-family: var(--mono); font-size: 11px; color: var(--haze-dim); }

.ledger-list { padding-bottom: 10px; display: flex; flex-direction: column; gap: 1px; }

.ledger-row {
  width: 100%;
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px 5px 9px;
  font: inherit; font-size: 12.5px;
  color: var(--haze);
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  text-align: left;
}
.ledger-row:hover { background: var(--ink-2); color: var(--paper); }
.ledger-row.is-on { background: var(--accent-wash); color: var(--paper); border-left-color: var(--accent); }

.ledger-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ledger-count { font-family: var(--mono); font-size: 11px; color: var(--haze-dim); }
.ledger-row.is-on .ledger-count { color: var(--accent-bright); }

/* Tag colours come from the feed itself, not from our palette. */
.tag-row { border-left-color: var(--stripe, transparent); }
.tag-row:not(.is-on) { border-left-color: color-mix(in srgb, var(--stripe, transparent) 60%, transparent); }
.tone-edge-red    { border-left-color: var(--tone-red) !important; }
.tone-edge-amber  { border-left-color: var(--tone-amber) !important; }
.tone-edge-green  { border-left-color: var(--tone-green) !important; }
.tone-edge-white  { border-left-color: var(--tone-white) !important; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--haze-dim); flex: none; }
.tone-red    { --dotc: var(--tone-red); }
.dot.tone-red { background: var(--tone-red); }
.dot.tone-amber { background: var(--tone-amber); }
.dot.tone-green { background: var(--tone-green); }
.dot.tone-grey { background: var(--tone-grey); }
.dot.tone-white { background: var(--tone-white); }
.dot.node-event { background: var(--accent); }
.dot.node-object { background: var(--node-object); }
.dot.node-attribute { background: var(--node-attribute); }
.dot.node-cluster { background: var(--node-cluster); }
.dot.node-tag { background: var(--node-tag); }

.date-row { display: flex; align-items: center; gap: 8px; padding-bottom: 12px; }
.date-row .field { flex: 1; min-width: 0; }
.date-sep { color: var(--haze-dim); }

.ledger-backdrop { display: none; }

/* --------------------------------------------------------------- chips --- */

.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px;
  max-width: 100%;
  font: inherit; font-size: 11.5px;
  color: var(--haze);
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  overflow: hidden;
}
button.chip:hover { color: var(--paper); border-color: var(--accent-dim); }
.chip > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.chip-ns { color: var(--haze-dim); font-family: var(--mono); font-size: 10px; text-transform: lowercase; }
.chip-galaxy { border-color: rgba(199, 125, 255, 0.3); }
.chip-galaxy .chip-ns { color: var(--node-cluster); }
.chip-more { color: var(--haze-dim); cursor: default; }

.chip-coloured { border-left: 3px solid var(--stripe); }

.chip-active { background: var(--accent-wash); border-color: var(--accent-dim); color: var(--paper); }
.chip-scope { border-color: var(--accent); }

.tone-fill-red   { background: rgba(229, 72, 77, 0.14); border-color: rgba(229, 72, 77, 0.45); color: #FFB3B5; }
.tone-fill-amber { background: rgba(245, 165, 36, 0.13); border-color: rgba(245, 165, 36, 0.45); color: #FFD08A; }
.tone-fill-green { background: rgba(70, 167, 88, 0.13); border-color: rgba(70, 167, 88, 0.45); color: #9BE0AC; }
.tone-fill-white { background: rgba(220, 227, 240, 0.1); border-color: rgba(220, 227, 240, 0.4); color: var(--tone-white); }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px;
  font-size: 11.5px; font-weight: 500;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--haze);
  white-space: nowrap;
}
.pill.tone-red   { color: #FFB3B5; border-color: rgba(229, 72, 77, 0.5); }
.pill.tone-amber { color: #FFD08A; border-color: rgba(245, 165, 36, 0.5); }
.pill.tone-green { color: #9BE0AC; border-color: rgba(70, 167, 88, 0.5); }
.pill.tone-grey  { color: var(--haze); }
.pill-quiet { color: var(--haze-dim); }

/* --------------------------------------------------------- scope + tabs -- */

.scope-strip {
  display: flex; flex-wrap: wrap; gap: 12px;
  align-items: center; justify-content: space-between;
  padding-bottom: 12px;
}

.scope-counts { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.scope-n { font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--paper); }
.scope-of { color: var(--haze); font-size: 13px; }
.scope-tag { font-family: var(--mono); font-size: 11.5px; color: var(--accent-bright); border-left: 1px solid var(--line); padding-left: 10px; }
.scope-warn { font-family: var(--mono); font-size: 11.5px; color: var(--tone-amber); }

.scope-actions { display: flex; gap: 8px; align-items: center; }
.selection-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 4px 4px 12px; border: 1px solid var(--accent-dim); border-radius: var(--radius); background: var(--accent-wash); }
.selection-count { font-family: var(--mono); font-size: 12.5px; }

.filter-toggle { display: none; }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 17px; height: 17px; padding: 0 4px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  background: var(--accent); color: #10131C;
  border-radius: 999px;
}

.viewtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 20px; overflow-x: auto; scrollbar-width: none; }
.viewtabs::-webkit-scrollbar { display: none; }

.viewtab {
  padding: 9px 15px;
  font: inherit; font-size: 13.5px;
  color: var(--haze);
  background: none; border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  cursor: pointer;
  white-space: nowrap;
}
.viewtab:hover { color: var(--paper); }
.viewtab.is-on { color: var(--paper); border-bottom-color: var(--accent); }

/* ---------------------------------------------------------- event cards -- */

.event-list { display: flex; flex-direction: column; gap: 1px; background: var(--line-soft); border: 1px solid var(--line-soft); border-radius: var(--radius); overflow: hidden; }

.event-card {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  background: var(--ink-2);
  border-left: 2px solid transparent;
  animation: rowin 240ms ease both;
  animation-delay: calc(var(--i, 0) * 11ms);
}
.event-card:hover { background: var(--ink-3); }
.event-card.is-selected { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent-wash) 55%, var(--ink-2)); }

@keyframes rowin { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.card-select { display: flex; align-items: flex-start; justify-content: center; padding: 15px 0 0; cursor: pointer; }
.card-select input { accent-color: var(--accent); width: 15px; height: 15px; }

.card-body { padding: 13px 16px 13px 0; min-width: 0; display: flex; flex-direction: column; gap: 7px; }

.card-meta { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; font-size: 12px; color: var(--haze); }
.card-date { font-family: var(--mono); color: var(--paper); }
.card-org { color: var(--haze); }

.card-title { font-size: 15px; font-weight: 500; color: var(--paper); line-height: 1.4; overflow-wrap: anywhere; }
.card-title:hover { color: var(--accent-bright); text-decoration: none; }

.card-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.card-foot { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--haze-dim); }

.uuid { font-size: 11px; color: var(--haze-dim); overflow-wrap: anywhere; }
.uuid-lg { font-size: 12px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 22px 0 8px; }
.pager-state { font-family: var(--mono); font-size: 12.5px; color: var(--haze); }

/* ------------------------------------------------------------- panels ---- */

.dash-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); align-items: start; }

.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink-2); overflow: hidden; }
.panel-wide { grid-column: 1 / -1; }

.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line-soft); }
.panel-head h3 { font-size: 13.5px; }
.panel-note { font-family: var(--mono); font-size: 11px; color: var(--haze-dim); }
.panel-body { padding: 16px; }
.panel-cta { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart-tick { fill: var(--haze-dim); font-family: var(--mono); font-size: 10px; }
.hbar:hover rect:first-child { fill: var(--accent-bright); }

.donut-row { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.chart-donut { width: 128px; height: 128px; flex: none; }
.donut-value { fill: var(--paper); font-family: var(--mono); font-size: 17px; font-weight: 600; }
.donut-label { fill: var(--haze-dim); font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.1em; text-transform: uppercase; }

.legend { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; flex: 1; min-width: 130px; }
.legend li { display: flex; align-items: center; gap: 8px; }
.legend-v { margin-left: auto; font-family: var(--mono); font-size: 11.5px; color: var(--haze-dim); }

.rank { display: flex; flex-direction: column; gap: 6px; }

.rank-row {
  display: grid;
  grid-template-columns: minmax(110px, 1.25fr) minmax(50px, 1fr) auto;
  gap: 10px; align-items: center;
  font: inherit; font-size: 12.5px;
  background: none; border: none; padding: 2px 0;
  color: var(--haze);
  text-align: left;
}
button.rank-row { cursor: pointer; }
button.rank-row:hover .rank-label { color: var(--accent-bright); }

.rank-label { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.rank-main { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--paper); }
.rank-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 10.5px; color: var(--haze-dim); }
.rank-track { height: 7px; background: var(--ink-4); border-radius: 2px; overflow: hidden; }
.rank-fill { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.rank-value { font-family: var(--mono); font-size: 11.5px; color: var(--haze-dim); }

.stat-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.stat dt { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--haze-dim); }
.stat dd { font-family: var(--mono); font-size: 22px; font-weight: 600; color: var(--paper); margin-top: 2px; }

.kv { display: flex; flex-direction: column; gap: 11px; }
.kv-row { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 12px; font-size: 13px; }
.kv-row dt { color: var(--haze-dim); }
.kv-row dd { overflow-wrap: anywhere; }

.plain-list { display: flex; flex-direction: column; gap: 7px; font-size: 12.5px; }

/* -------------------------------------------------------------- tables --- */

.ioc-head { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.ioc-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; flex: 1; min-width: 260px; }
.ioc-controls .field[type="search"] { flex: 1; min-width: 180px; }
.ioc-export { display: flex; gap: 6px; flex-wrap: wrap; }
.ioc-summary { display: flex; align-items: baseline; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }

.table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th {
  position: sticky; top: 0; z-index: 1;
  padding: 9px 12px;
  text-align: left;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--haze-dim);
  background: var(--ink-3);
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table td { padding: 8px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: var(--ink-2); }

.cell-value { max-width: 460px; }
.cell-value code { font-size: 12.5px; overflow-wrap: anywhere; color: var(--paper); }
.attr-table .col-value { width: 52%; }
.attr-table .cell-value { max-width: none; }
.attr-table tr.is-rule td { background: rgba(124, 140, 255, 0.03); }
.cell-object { font-size: 12.5px; }
.obj-ref { display: inline-flex; flex-direction: column; line-height: 1.35; }
.obj-ref-name { font-family: var(--mono); color: var(--node-object); }
.obj-ref-rel { font-family: var(--mono); font-size: 11px; color: var(--haze-dim); }
.cell-event { max-width: 240px; }
.cell-event a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.cell-comment { max-width: 280px; font-size: 12.5px; }
.cell-actions { width: 40px; text-align: right; }

.type-tag { font-family: var(--mono); font-size: 11.5px; color: var(--accent-bright); white-space: nowrap; }

/* ------------------------------------------------------------- values ---- */
/* Copy sits right against the value it copies. */

.value-line { display: flex; align-items: flex-start; gap: 6px; min-width: 0; }
.value-line > .ids-flag { margin-top: 2px; }
.value-text { flex: 0 1 auto; font-family: var(--mono); font-size: 12.5px; color: var(--paper); overflow-wrap: anywhere; min-width: 0; user-select: text; }
a.value-link { color: var(--accent-bright); }
.copy-btn {
  flex: none;
  display: inline-grid; place-items: center;
  width: 20px; height: 20px; margin-top: -1px;
  font-size: 12px; line-height: 1;
  color: var(--haze-dim);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
}
.copy-btn:hover, .copy-btn:focus-visible { color: var(--paper); background: var(--ink-4); border-color: var(--line); }
tr:hover .copy-btn, .obj-row:hover .copy-btn { color: var(--haze); }

.value-long-wrap { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.value-long { font-size: 12.5px; color: var(--paper); white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; flex: 1; min-width: 0; }
.value-long.is-clamped { display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }

/* Detection rules: a code block, not a run-on line. */
.rule-block { border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink); overflow: hidden; min-width: 0; }
.rule-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 6px 8px 6px 10px;
  background: var(--ink-3);
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
}
.rule-lang { font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-bright); }
.rule-block[data-family='sigma'] .rule-lang { color: #5CC8D6; }
.rule-block[data-family='snort'] .rule-lang { color: #D6A2F5; }
.rule-name { font-family: var(--mono); color: var(--paper); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46ch; }
.rule-lines { color: var(--haze-dim); font-family: var(--mono); font-size: 10.5px; }
.rule-actions { display: flex; gap: 4px; margin-left: auto; }
.mini-btn {
  padding: 2px 8px;
  font: inherit; font-family: var(--mono); font-size: 11px;
  color: var(--haze);
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
}
.mini-btn:hover { color: var(--paper); border-color: var(--accent-dim); }
.rule-code {
  margin: 0; padding: 10px 12px;
  font-family: var(--mono); font-size: 12px; line-height: 1.6;
  color: var(--paper);
  white-space: pre-wrap; overflow-wrap: anywhere;
  tab-size: 4;
  max-height: none; overflow: auto;
}
.rule-code.is-clamped { max-height: calc(18 * 1.6em + 20px); overflow: hidden; -webkit-mask-image: linear-gradient(#000 80%, transparent); mask-image: linear-gradient(#000 80%, transparent); }
.rule-toggle { align-self: flex-start; margin: 0; padding: 5px 10px; font: inherit; font-size: 12px; color: var(--accent-bright); background: none; border: none; cursor: pointer; }
.rule-block > .rule-toggle { display: block; width: 100%; text-align: left; border-top: 1px solid var(--line-soft); }
.rule-toggle:hover { text-decoration: underline; }
.rule-stack { display: flex; flex-direction: column; gap: 12px; }

.hl-kw { color: #A2AEFF; }
.hl-str { color: #9ED7C9; }
.hl-var { color: #E2B6FF; }
.hl-num { color: #8FD3FF; }
.hl-com { color: var(--haze-dim); font-style: italic; }
.hl-key { color: #A2AEFF; }
.hl-name { color: #FFFFFF; font-weight: 600; }

/* Detection-rule marks: kept off red, amber and green, which are TLP data. */
.rule-badge {
  display: inline-flex; align-items: center;
  padding: 1px 7px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.04em;
  color: var(--rc, var(--accent-bright));
  border: 1px solid color-mix(in srgb, var(--rc, var(--accent-bright)) 45%, transparent);
  border-radius: 3px;
}
.rule-mark { width: 9px; height: 9px; border-radius: 2px; background: var(--rc, var(--accent-bright)); flex: none; }
.rule-any { --rc: var(--paper); }
.rule-yara { --rc: #8FA0FF; }
.rule-sigma { --rc: #5CC8D6; }
.rule-snort { --rc: #D6A2F5; }
.rule-zeek { --rc: #9DB4CF; }
.rule-stix, .rule-kql, .rule-pattern { --rc: #A9B4CC; }
.obj-link-group { min-width: 0; }
.gp-close { flex: none; }
.rule-row .ledger-label { flex: 1; }
.rule-scan { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; padding-bottom: 12px; }
.rule-partial { padding: 4px 0 12px; }

.ids-flag {
  display: inline-block; margin-left: 2px; flex: none;
  padding: 0 4px;
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--tone-green);
  border: 1px solid rgba(70, 167, 88, 0.45);
  border-radius: 2px;
  vertical-align: 2px;
}
.flag-data { color: var(--node-object); border-color: rgba(76, 194, 196, 0.45); }
.attr-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.table-note { margin-top: 10px; }

/* ------------------------------------------------------------- event pg -- */

.event-head { padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.backlink { font-size: 13px; color: var(--haze); }
.backlink:hover { color: var(--accent-bright); }

.event-crown { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-start; justify-content: space-between; margin-top: 12px; }
.event-ident { min-width: 0; flex: 1; }
.event-title { font-size: clamp(21px, 3vw, 30px); line-height: 1.22; letter-spacing: -0.022em; margin: 8px 0 12px; overflow-wrap: anywhere; }
.event-badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.event-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Tag board: taxonomies by namespace, clusters by galaxy, markings up top. */
.marking {
  display: inline-flex; align-items: center;
  padding: 3px 8px;
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
  border: 1px solid var(--line); border-radius: 3px;
}

.tagboard { display: grid; gap: 14px; margin-top: 18px; }
.tagboard.is-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.tagboard-col { border: 1px solid var(--line-soft); border-radius: var(--radius-lg); background: var(--ink-2); padding: 12px 14px 6px; min-width: 0; }
.tagboard-title {
  display: flex; align-items: baseline; gap: 8px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.1em; text-transform: uppercase; color: var(--haze-dim);
  margin-bottom: 6px;
}
.tagboard-galaxies .tagboard-title { color: var(--node-cluster); }
.tagboard-n { color: var(--haze-dim); letter-spacing: 0; }
.tagboard-rows { display: flex; flex-direction: column; }
.tb-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-top: 1px solid var(--line-soft); align-items: start; }
.tb-row:first-child { border-top: none; }
.tb-label { font-family: var(--mono); font-size: 11.5px; color: var(--haze); padding-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-label a { color: var(--node-cluster); }
.tb-chips { display: flex; flex-wrap: wrap; gap: 5px; min-width: 0; }
.tb-chip {
  display: inline-flex; align-items: baseline; gap: 6px;
  max-width: 100%;
  padding: 3px 8px;
  font: inherit; font-size: 12px; line-height: 1.35;
  color: var(--paper);
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  text-decoration: none;
}
.tb-chip:hover { border-color: var(--accent-dim); background: var(--ink-4); text-decoration: none; }
.tb-coloured { border-left: 3px solid var(--stripe); }
.tb-pred { font-family: var(--mono); font-size: 10.5px; color: var(--haze-dim); white-space: nowrap; }
.tb-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tb-cluster { border-color: rgba(199, 125, 255, 0.28); }
.tb-cluster:hover { border-color: var(--node-cluster); }
.tb-ext { font-size: 10.5px; color: var(--node-cluster); }
.tb-more { font: inherit; font-size: 11.5px; color: var(--accent-bright); background: none; border: 1px dashed var(--line); border-radius: 3px; padding: 3px 8px; cursor: pointer; }
.tb-more:hover { border-color: var(--accent-dim); }


/* Objects: packed in columns so cards of different heights sit neatly. */
.obj-filter { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.object-masonry { column-width: 400px; column-gap: 14px; }
.obj {
  break-inside: avoid;
  display: flex; flex-direction: column;
  margin-bottom: 14px;
  border: 1px solid var(--line);
  border-top: 2px solid var(--node-object);
  border-radius: var(--radius-lg);
  background: var(--ink-2);
  overflow: hidden;
  scroll-margin-top: calc(var(--chrome-h) + 20px);
}
.obj.is-flash { animation: obj-flash 1.4s ease-out; }
@keyframes obj-flash { 0% { box-shadow: 0 0 0 3px var(--node-object); } 100% { box-shadow: 0 0 0 0 transparent; } }
.obj-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 4px; }
.obj-title { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.obj-name { font-family: var(--mono); font-size: 14.5px; font-weight: 600; color: var(--node-object); }
.obj-cat { font-family: var(--mono); font-size: 10.5px; color: var(--haze-dim); border: 1px solid var(--line); border-radius: 3px; padding: 0 5px; }
.obj-count { font-size: 11.5px; color: var(--haze-dim); white-space: nowrap; }
.obj-desc { padding: 0 14px 10px; font-size: 12px; color: var(--haze-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.obj-comment { padding: 0 14px 10px; font-size: 12.5px; color: var(--haze); }
.obj-rows { display: flex; flex-direction: column; border-top: 1px solid var(--line-soft); }
.obj-row {
  display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 12px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--line-soft);
  align-items: baseline;
}
.obj-row:last-child { border-bottom: none; }
.obj-row:hover { background: var(--ink-3); }
.obj-row-rule { grid-template-columns: minmax(0, 1fr); gap: 6px; }
.obj-rel { font-family: var(--mono); font-size: 11px; color: var(--haze-dim); overflow-wrap: anywhere; }
.obj-row.is-ids .obj-rel { color: var(--haze); }
.obj-val { min-width: 0; }
.obj-val .value-text { word-break: break-all; }
.obj-links { display: grid; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line-soft); background: rgba(0, 0, 0, 0.14); }
.obj-sub { font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--haze-dim); margin-bottom: 5px; }
.obj-link-list { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.obj-link-list li { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.rel-type { font-family: var(--mono); font-size: 11px; color: var(--node-object); white-space: nowrap; }
.rel-arrow { color: var(--haze-dim); }
.rel-target { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 12px; }
.obj-foot { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-top: 1px solid var(--line-soft); }
.obj-foot .uuid { font-size: 11px; color: var(--haze-dim); overflow: hidden; text-overflow: ellipsis; }

.galaxy-wrap { display: flex; flex-direction: column; gap: 28px; }
.galaxy-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.galaxy-page-link { margin-left: auto; font-size: 12.5px; color: var(--node-cluster); }
.galaxy-head h3 { font-family: var(--mono); font-size: 15px; color: var(--node-cluster); }

.cluster-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); align-items: start; }
.cluster-card { border: 1px solid var(--line); border-left: 2px solid var(--node-cluster); border-radius: var(--radius); background: var(--ink-2); padding: 15px; }
.cluster-head { margin-bottom: 6px; }
.cluster-name { display: inline; font-size: 14.5px; font-weight: 600; color: var(--paper); }
a.cluster-name:hover { color: var(--node-cluster); }
.cluster-meta { margin: 10px 0; gap: 6px; }
.cluster-meta .kv-row { grid-template-columns: 120px minmax(0, 1fr); font-size: 12.5px; }
.cluster-syn { font-size: 12px; color: var(--haze-dim); margin-bottom: 8px; }
.cluster-desc { font-size: 13px; color: var(--haze); margin-bottom: 10px; }
.cluster-refs { display: flex; flex-direction: column; gap: 4px; font-size: 12px; margin: 10px 0; }
.cluster-refs a { overflow-wrap: anywhere; }
.cluster-foot { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.tagname { font-size: 11px; color: var(--haze-dim); overflow-wrap: anywhere; flex: 1; }

.report { margin-bottom: 18px; }
.report h4 { font-size: 13.5px; margin-bottom: 8px; }
.report-body { white-space: pre-wrap; font-family: var(--mono); font-size: 12.5px; color: var(--haze); max-height: 420px; overflow: auto; margin: 0; }

.raw-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.raw-json {
  margin: 0; padding: 16px;
  max-height: 72vh; overflow: auto;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px; line-height: 1.6;
  color: var(--haze);
  white-space: pre;
  tab-size: 2;
}

/* --------------------------------------------------------------- graph --- */

.graph-shell { display: flex; flex-direction: column; gap: 10px; }
.graph-toolbar { display: flex; flex-direction: column; gap: 8px; }
.graph-tools-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.graph-search { flex: 1 1 240px; min-width: 0; max-width: 420px; }
.graph-labels { width: auto; }
.graph-view-btns { display: flex; gap: 6px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.graph-zoom { width: 30px; height: 30px; font-size: 15px; border: 1px solid var(--line); }
.graph-toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.graph-toggle {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px;
  font: inherit; font-size: 12px;
  color: var(--paper);
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.graph-toggle:hover { border-color: var(--accent-dim); }
.graph-toggle.is-off { color: var(--haze-dim); background: transparent; }
.graph-toggle.is-off .dot { opacity: 0.35; }
.graph-toggle.is-active { border-color: var(--node-object); }
.graph-toggle-n { font-family: var(--mono); font-size: 11px; color: var(--haze-dim); }
.graph-focus-bar { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: var(--haze); padding: 6px 10px; border: 1px solid var(--accent-dim); border-radius: var(--radius); background: var(--accent-wash); }

.graph-canvas {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 1px 1px, var(--line-soft) 1px, transparent 0) 0 0 / 22px 22px,
    var(--ink-2);
  overflow: hidden;
  touch-action: none;
}
.graph-svg { display: block; width: 100%; height: auto; max-height: 78vh; cursor: grab; user-select: none; }
.graph-svg:active { cursor: grabbing; }

.graph-link { stroke: var(--line); stroke-width: 1; transition: opacity 0.15s; }
.graph-link-galaxy { stroke: rgba(199, 125, 255, 0.45); }
.graph-link-object { stroke: rgba(76, 194, 196, 0.45); }
.graph-link-attribute { stroke: rgba(140, 152, 178, 0.35); }
.graph-link-reference { stroke: var(--node-object); stroke-width: 1.4; stroke-dasharray: 4 3; }
.graph-link-tag { stroke: var(--line); stroke-dasharray: 2 3; }

.graph-node { cursor: pointer; outline: none; transition: opacity 0.15s; }
.graph-hit { fill: transparent; }
.graph-dot { stroke-width: 0; }
.graph-node-event .graph-dot { fill: var(--accent); stroke: var(--accent-bright); stroke-width: 2; }
.graph-node-object .graph-dot { fill: var(--node-object); }
.graph-node-attribute .graph-dot { fill: var(--node-attribute); fill-opacity: 0.8; }
.graph-node-cluster .graph-dot { fill: var(--node-cluster); }
.graph-node-tag .graph-dot { fill: var(--node-tag); }
.graph-node.is-ids .graph-dot { stroke: var(--paper); stroke-width: 1.5; }
.graph-shared-ring { fill: none; stroke: var(--accent-bright); stroke-width: 1.2; stroke-dasharray: 2 2; }
.graph-node:hover .graph-dot, .graph-node:focus-visible .graph-dot { stroke: var(--accent-bright); stroke-width: 2.5; }
.graph-node.is-selected .graph-dot { stroke: var(--paper); stroke-width: 3; }

.graph-label { fill: var(--haze); font-family: var(--mono); font-size: 9.5px; pointer-events: none; paint-order: stroke; stroke: var(--ink-2); stroke-width: 3px; stroke-linejoin: round; }
.graph-node-attribute .graph-label { font-size: 8.5px; fill: var(--haze-dim); }
.graph-node-object .graph-label, .graph-node-cluster .graph-label { fill: var(--paper); font-size: 10px; }
.graph-node-event .graph-label { fill: var(--paper); font-size: 12px; font-weight: 600; }
.graph-svg[data-labels='key'] .graph-node-attribute .graph-label,
.graph-svg[data-labels='key'] .graph-node-tag .graph-label,
.graph-svg[data-labels='none'] .graph-label { display: none; }
.graph-svg.is-far[data-labels='all'] .graph-node-attribute:not(.is-near):not(.is-match):not(.is-selected) .graph-label { display: none; }
.graph-node.is-near .graph-label, .graph-node.is-match .graph-label, .graph-node.is-selected .graph-label { display: inline; fill: var(--paper); }

.graph-svg.has-hover .graph-node:not(.is-near) { opacity: 0.25; }
.graph-svg.has-hover .graph-link:not(.is-near) { opacity: 0.12; }
.graph-svg.is-searching .graph-node:not(.is-match) { opacity: 0.2; }
.graph-svg.is-searching .graph-link { opacity: 0.12; }
.graph-node.is-match .graph-dot { stroke: var(--accent-bright); stroke-width: 3; }
.graph-node.is-hidden, .graph-link.is-hidden { display: none; }

.graph-popup {
  position: absolute; z-index: 5;
  width: min(360px, calc(100% - 16px));
  max-height: calc(100% - 16px);
  display: flex; flex-direction: column;
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}
.graph-popup[hidden] { display: none; }
/* On phones the popup sits under the graph rather than on top of it. */
.graph-popup.is-docked { position: relative; left: auto; top: auto; width: auto; max-height: none; margin: 0; border-width: 1px 0 0; border-radius: 0; box-shadow: none; }
.gp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px 8px 14px; border-bottom: 1px solid var(--line-soft); }
.gp-kind { font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; color: var(--haze); }
.gp-kind.kind-attribute { color: var(--accent-bright); }
.gp-kind.kind-object { color: var(--node-object); }
.gp-kind.kind-cluster { color: var(--node-cluster); }
.gp-body { display: flex; flex-direction: column; gap: 9px; padding: 12px 14px; overflow: auto; font-size: 12.5px; }
.gp-value { font-size: 12.5px; color: var(--paper); word-break: break-all; user-select: text; }
.gp-code { margin: 0; max-height: 200px; overflow: auto; font-size: 11.5px; line-height: 1.5; color: var(--paper); white-space: pre-wrap; word-break: break-word; background: var(--ink-2); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 8px; }
.gp-title { font-size: 14px; font-weight: 600; color: var(--paper); overflow-wrap: anywhere; }
.gp-desc { color: var(--haze); line-height: 1.5; }
.gp-tag { font-size: 11px; color: var(--haze-dim); overflow-wrap: anywhere; }
.gp-field { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; }
.gp-label { font-family: var(--mono); font-size: 10.5px; color: var(--haze-dim); padding-top: 1px; }
.gp-text { white-space: pre-line; overflow-wrap: anywhere; color: var(--paper); }
.gp-rows { display: flex; flex-direction: column; gap: 4px; }
.gp-row { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 10px; }
.gp-row dt { font-family: var(--mono); font-size: 10.5px; color: var(--haze-dim); overflow: hidden; text-overflow: ellipsis; }
.gp-row dd { font-family: var(--mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gp-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 14px; border-top: 1px solid var(--line-soft); }

.graph-status { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; font-size: 12px; color: var(--haze); }
.graph-shared-note { display: inline-flex; align-items: center; gap: 6px; }
.shared-swatch { width: 12px; height: 12px; border-radius: 50%; border: 1.2px dashed var(--accent-bright); }

/* -------------------------------------------------------------- lookup --- */

.lookup { max-width: 780px; display: flex; flex-direction: column; gap: 14px; }
.lookup h3 { font-size: 17px; }
.lookup-input { min-height: 120px; }
.lookup-summary { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.lookup-results { display: flex; flex-direction: column; }

.lookup-row { display: grid; grid-template-columns: minmax(140px, 0.6fr) minmax(0, 1fr); gap: 14px; padding: 11px 0 11px 12px; border-bottom: 1px solid var(--line-soft); border-left: 2px solid var(--line); }
.lookup-row.is-hit { border-left-color: var(--tone-amber); }
.lookup-row.is-miss { border-left-color: var(--line); }
.lookup-needle { font-size: 12.5px; overflow-wrap: anywhere; color: var(--paper); }
.lookup-hits { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; }
.lookup-hit { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lookup-fallback { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }

.lookup-modes { display: flex; flex-wrap: wrap; gap: 18px; margin: 12px 0 4px; }
.lookup-note { margin: 14px 0 4px; }
.lookup-note p + p { margin-top: 8px; }
.lookup-suggest { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.lookup-samples { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.lookup-sample { font-size: 11.5px; padding: 2px 7px; border-radius: 4px; background: var(--ink-3); border: 1px solid var(--line); color: var(--accent-bright); overflow-wrap: anywhere; }

/* ------------------------------------------------------ states + panels -- */

.loading-panel { display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 90px 20px; }
.loading-text { font-family: var(--mono); font-size: 12.5px; color: var(--haze-dim); text-align: center; overflow-wrap: anywhere; max-width: 90%; }

.scanner { width: 200px; height: 2px; background: var(--ink-4); overflow: hidden; position: relative; }
.scanner::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: sweep 1.15s ease-in-out infinite;
}
@keyframes sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.empty { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; padding: 56px 4px; max-width: 62ch; }
.empty h3 { font-size: 17px; }
.empty-sm { padding: 32px 4px; }

.error-panel { max-width: 640px; padding: 40px 0; display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.error-panel h2 { font-size: 21px; }
.error-copy { color: #FFB3B5; font-size: 14px; }
.error-url { font-size: 12px; color: var(--haze-dim); overflow-wrap: anywhere; padding: 9px 12px; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); width: 100%; }
.error-hints { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; font-size: 12.5px; color: var(--haze-dim); }
.error-hints li { padding-left: 14px; position: relative; }
.error-hints li::before { content: '·'; position: absolute; left: 4px; }

.progress-panel { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; padding: 48px 0; max-width: 520px; }
.progress-track { width: 100%; height: 3px; background: var(--ink-4); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--accent); transition: width 180ms linear; }
.progress-note { font-family: var(--mono); font-size: 12.5px; color: var(--haze); }

.notice { padding: 13px 16px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--ink-2); margin-bottom: 18px; }
.notice-warn { border-color: rgba(245, 165, 36, 0.45); }
.notice-warn p:first-child { color: #FFD08A; font-size: 13.5px; }

/* ------------------------------------------------------------ settings --- */

.settings { max-width: 780px; }
.page-title { font-size: clamp(24px, 3.4vw, 32px); letter-spacing: -0.024em; margin: 8px 0 14px; }
.page-subtitle { font-size: 17px; margin: 42px 0 10px; }

.card { padding: 22px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--ink-2); margin-top: 18px; }
.card .field-row:last-of-type { margin-bottom: 22px; }

.test-out { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.test-ok p { color: #9BE0AC; font-size: 13.5px; }

/* -------------------------------------------------------------- modals --- */

.modal {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
  background: rgba(6, 8, 13, 0.72);
  backdrop-filter: blur(3px);
  animation: fade 140ms ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.modal-panel {
  width: 100%;
  max-height: 88dvh;
  display: flex; flex-direction: column;
  background: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  animation: rise 160ms ease;
}
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { font-size: 16px; }
.modal-body { padding: 18px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line-soft); flex-wrap: wrap; }
.modal-copy { color: var(--haze); font-size: 13.5px; margin-bottom: 16px; }
.modal-copy strong { color: var(--paper); }

.import-form .field-row:last-of-type { margin-bottom: 14px; }
.import-status { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }

.result-list { display: flex; flex-direction: column; gap: 7px; margin-top: 14px; font-size: 13px; max-height: 320px; overflow-y: auto; }
.result-list li { display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap; }
.result-mode { font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; padding: 1px 5px; border-radius: 2px; border: 1px solid var(--line); color: var(--haze-dim); flex: none; }
.result-ok .result-mode { color: var(--tone-green); border-color: rgba(70, 167, 88, 0.45); }
.result-bad .result-mode { color: var(--tone-red); border-color: rgba(229, 72, 77, 0.45); }
.result-error { color: var(--haze-dim); font-size: 12px; flex-basis: 100%; padding-left: 8px; overflow-wrap: anywhere; }

/* -------------------------------------------------------------- toasts --- */

.toast-host { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 80; display: flex; flex-direction: column; gap: 8px; width: min(460px, calc(100vw - 28px)); }

.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 12px 11px 15px;
  background: var(--ink-3);
  border: 1px solid var(--line);
  border-left: 2px solid var(--accent);
  border-radius: var(--radius);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  font-size: 13.5px;
  animation: toastin 180ms ease;
}
.toast-ok { border-left-color: var(--tone-green); }
.toast-warn { border-left-color: var(--tone-amber); }
.toast-text { flex: 1; min-width: 0; }
.toast-action { font: inherit; font-size: 13px; font-weight: 600; color: var(--accent-bright); background: none; border: none; cursor: pointer; white-space: nowrap; }
.toast-close { font: inherit; font-size: 17px; line-height: 1; color: var(--haze-dim); background: none; border: none; cursor: pointer; padding: 0 2px; }
.toast-close:hover { color: var(--paper); }
.toast-leaving { opacity: 0; transform: translateY(6px); transition: opacity 180ms ease, transform 180ms ease; }

@keyframes toastin { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

mark { background: rgba(124, 140, 255, 0.28); color: var(--paper); border-radius: 2px; padding: 0 1px; }

/* --------------------------------------------------------- breakpoints -- */

@media (max-width: 1180px) {
  :root { --ledger-w: 260px; }
}

@media (max-width: 900px) {
  .tagboard.is-split { grid-template-columns: minmax(0, 1fr); }
  .graph-view-btns { margin-left: 0; }
  .feed-body { grid-template-columns: minmax(0, 1fr); gap: 0; }

  .ledger {
    position: fixed; inset: 0 auto 0 0; z-index: 55;
    width: min(330px, 88vw);
    max-height: none;
    padding: 16px;
    background: var(--ink-2);
    border-right: 1px solid var(--line);
    transform: translateX(-102%);
    transition: transform 200ms ease;
  }
  body.ledger-open .ledger { transform: none; }
  .ledger-close { display: inline-flex; }

  .ledger-backdrop { display: block; position: fixed; inset: 0; z-index: 54; background: rgba(6, 8, 13, 0.6); opacity: 0; pointer-events: none; transition: opacity 200ms ease; }
  body.ledger-open .ledger-backdrop { opacity: 1; pointer-events: auto; }

  .filter-toggle {
    display: inline-flex; align-items: center; gap: 7px;
    padding: 6px 12px;
    font: inherit; font-size: 13px;
    color: var(--paper);
    background: var(--ink-3);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    cursor: pointer;
  }

  .col-hide-md { display: none; }
}

@media (max-width: 680px) {
  .tb-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .obj-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .attr-table .col-value { width: auto; }
  .gp-field, .gp-row { grid-template-columns: 80px minmax(0, 1fr); }
  body { font-size: 14.5px; }
  .chrome { gap: 12px; }
  .chrome-nav { gap: 0; }
  .nav-link { padding: 6px 9px; font-size: 13px; }
  .status-text { display: none; }
  .misp-status { padding: 6px 9px; }

  .hero-title { max-width: none; }
  .prompt-kind { flex-direction: row; flex-wrap: wrap; }
  .built-row { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .step { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .setup-row { grid-template-columns: auto minmax(0, 1fr); }
  .setup-row .btn { grid-column: 2; justify-self: start; }

  .feed-topline { align-items: flex-start; }
  .feed-actions { width: 100%; }
  .feed-actions .btn { flex: 1; }

  .event-crown { flex-direction: column; }
  .event-actions { width: 100%; }
  .event-actions .btn { flex: 1; }

  .col-hide-sm { display: none; }
  .cell-value { max-width: none; }

  .scope-strip { gap: 10px; }
  .scope-actions { width: 100%; }
  .selection-bar { width: 100%; }

  .kv-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }

  .modal { padding: 0; align-items: flex-end; }
  .modal-panel { max-width: none !important; border-radius: var(--radius-lg) var(--radius-lg) 0 0; max-height: 92dvh; }

  .toast-host { bottom: 12px; }
}

@media (min-width: 1600px) {
  .dash-grid { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .scanner::after { animation: none; background: var(--accent); }
}

@media print {
  .chrome, .chrome-foot, .ledger, .viewtabs, .scope-actions, .feed-actions, .event-actions { display: none !important; }
  body { background: #fff; color: #000; }
}
