/* Attack Dashboard.
   One look: a dark, dense list app in the manner of Linear.
   Layout: a thin top bar, then one page. Lists are single-line rows with hairlines between them.
   Color is used only on status icons and for the one accent. */

:root {
  color-scheme: dark;

  --bg: #0e0f11;
  --canvas: #0e0f11;
  --surface: #151619;
  --raised: #1c1d21;
  --hover: rgba(255, 255, 255, 0.04);
  --line: rgba(255, 255, 255, 0.065);
  --line-strong: rgba(255, 255, 255, 0.12);

  --text: #e6e7ea;
  --muted: #8d919b;
  --faint: #62666f;
  --accent: #7c7bff;

  --crit: #eb5757;
  --warn: #f0b03f;
  --ok: #4cb782;
  --unknown: #6f737d;

  --font: Geist, Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --topbar: 44px; /* sticky headers and the side panel start under the top bar */
  --row: 38px; /* the height of every list row */
  --gutter: 28px; /* space at the left and right of the page */
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 13px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea { font: inherit; }
::selection { background: rgba(124, 123, 255, 0.35); }

a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, [contenteditable]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-radius: 5px;
}

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: flex;
  align-items: center;
  gap: 18px;
  height: var(--topbar);
  padding: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
  background: var(--bg);
}

.brand { display: flex; align-items: center; gap: 8px; flex: none; font-weight: 600; }
.brand-mark { width: 16px; height: 16px; border-radius: 5px; background: var(--accent); }

.nav { display: flex; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tab {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 28px;
  padding: 0 9px;
  border-radius: 6px;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.tab svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tab:hover { background: var(--hover); color: var(--text); }
.tab.active { background: rgba(255, 255, 255, 0.08); color: var(--text); }

.updated { margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--faint); }
.session { display: flex; align-items: center; gap: 10px; flex: none; font-size: 12px; color: var(--faint); }

/* ---------- Page ---------- */

/* The graph sits between the page title and the rest of the view.
   "display: contents" lets the view's children take part in the main column's ordering. */
.main { display: flex; flex-direction: column; padding: 0 var(--gutter) 80px; }
#view { display: contents; }
.header, #attack-head, #status-head { order: -2; }
#graph-stage { order: -1; }

.header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 20px 0 12px; }
.header-main { min-width: 0; }
.header h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.3; overflow-wrap: anywhere; }
.header-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 2px; font-size: 12.5px; color: var(--muted); }
.crumb:hover { color: var(--text); }
.crumb-gap { color: var(--faint); }

.quiet { color: var(--faint); }
.empty { padding: 14px 8px; color: var(--faint); }

/* ---------- Buttons ---------- */

.icon { flex: none; width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }

.button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.button:hover { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.button.active { color: var(--text); border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.button .icon { width: 14px; height: 14px; }
.button-danger:hover { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 50%, transparent); }

.icon-button {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: none;
  color: var(--muted);
}
.icon-button:hover, .icon-button.active { background: rgba(255, 255, 255, 0.07); color: var(--text); }

/* A switch: a short row of options where one is chosen. */
.switch { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line-strong); border-radius: 6px; padding: 1px; gap: 1px; }
.switch-option { height: 24px; padding: 0 9px; border: 0; border-radius: 4px; background: none; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.switch-option:hover { color: var(--text); }
.switch-option.active { background: rgba(255, 255, 255, 0.09); color: var(--text); }
.switch-count { margin-left: 6px; color: var(--faint); }

/* A toggle: one filter that is on or off. */
.toggle { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px; border: 0; border-radius: 6px; background: none; font-size: 12.5px; color: var(--faint); white-space: nowrap; }
.toggle svg { opacity: 0.4; }
.toggle:hover { background: var(--hover); }
.toggle.active { color: var(--text); }
.toggle.active svg { opacity: 1; }
.toggle .icon { width: 14px; height: 14px; }

/* ---------- Status: a small icon, sometimes with its word ---------- */

.status {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}
button.status { padding: 4px; margin: -4px; border-radius: 5px; }
button.status:hover { background: rgba(255, 255, 255, 0.08); color: var(--text); }

.status-icon { flex: none; width: 14px; height: 14px; color: var(--unknown); }
.status-icon.tone-crit { color: var(--crit); }
.status-icon.tone-warn { color: var(--warn); }
.status-icon.tone-ok { color: var(--ok); }
/* An empty ring means "not started". It stays grey whatever the tone. */
.status-icon.shape-ring { color: var(--muted); }
.status-icon.shape-dot { color: var(--faint); }

.status-pair { display: inline-flex; align-items: center; gap: 8px; }
.status-pair-label { color: var(--faint); font-size: 12.5px; }

.proof { font-size: 11.5px; color: var(--faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proof-none { color: var(--warn); }
.contained-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }

/* ---------- Avatars ---------- */

.avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: hsl(var(--hue, 0) 28% 30%);
  color: hsl(var(--hue, 0) 60% 86%);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.avatar-empty { background: none; border: 1px dashed var(--faint); opacity: 0.45; }
.avatar-more { background: var(--raised); color: var(--muted); }
.avatar-stack { display: inline-flex; }
.avatar-stack .avatar { box-shadow: 0 0 0 1.5px var(--bg); }
.avatar-stack .avatar + .avatar { margin-left: -5px; }

.owner { flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 3px; margin: -3px; border: 0; border-radius: 99px; background: none; color: var(--text); }
.owner:hover { background: rgba(255, 255, 255, 0.08); }
.owner:hover .avatar-empty { opacity: 1; }

/* ---------- Lists ---------- */

.list { min-width: 0; margin-top: 22px; }
.header + .list, .header + .add-row + .list { margin-top: 0; }

/* The line above a list: its name, how many, and the "+" button at the right. */
.list-head { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px; border-bottom: 1px solid var(--line); }
.list-title { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.list-count { font-size: 12px; color: var(--faint); }
.list-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* One row: status icon, text, quiet notes at the right. */
.item {
  display: flex;
  align-items: center;
  gap: 10px;
  height: var(--row);
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
}
.item:hover { background: var(--hover); }
.item-open, .item-open:hover { background: rgba(124, 123, 255, 0.1); }

.item-text {
  flex: 1 1 auto;
  min-width: 0;
  align-self: stretch;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-done { color: var(--muted); }

.item-type { flex: none; width: 62px; font-size: 12px; color: var(--faint); }

.item-meta { flex: none; display: flex; align-items: center; justify-content: flex-end; gap: 12px; min-width: 0; max-width: 46%; }
.item-note { flex: 0 1 auto; min-width: 0; max-width: 34%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.item-meta .item-note { max-width: 240px; }
.item-note-warn { color: var(--warn); }
.item-where { min-width: 0; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--faint); }
.item-where:hover { color: var(--text); }
.item-source { flex: none; display: grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; color: var(--faint); }
.item-source .icon { width: 14px; height: 14px; }
.item-source:hover { color: var(--text); background: rgba(255, 255, 255, 0.08); }
.item-warn { flex: none; display: grid; place-items: center; color: var(--crit); }
.item-warn .icon { width: 14px; height: 14px; }

/* A remove button in a row shows only while the pointer is on the row. */
.item .icon-button, .exec-update .icon-button { opacity: 0; }
.item:hover .icon-button, .exec-update:hover .icon-button, .item .icon-button:focus-visible, .exec-update .icon-button:focus-visible { opacity: 1; }

/* ---------- Groups: rows under a sticky header ---------- */

.group-head {
  position: sticky;
  top: var(--topbar);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 34px;
  padding: 0 8px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  text-align: left;
}
button.group-head:hover { background: var(--raised); }
.group-head .icon { width: 14px; height: 14px; color: var(--faint); transform: rotate(90deg); transition: transform 0.12s; }
.group-collapsed .group-head .icon { transform: none; }
@media (prefers-reduced-motion: reduce) { .group-head .icon { transition: none; } }

/* ---------- Tables: rows with columns ---------- */

.table { overflow-x: auto; }
.row {
  display: grid;
  gap: 14px;
  align-items: center;
  height: var(--row);
  min-width: 940px;
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
}
.row > * { min-width: 0; }
.row:not(.row-head):hover { background: var(--hover); }
.row-head { height: 30px; font-size: 12px; color: var(--faint); }
.row-clickable { cursor: pointer; }

.columns-places { grid-template-columns: minmax(260px, 1.6fr) 232px 104px 88px minmax(140px, 1.7fr) 62px minmax(140px, 1.4fr); }
.columns-services { grid-template-columns: minmax(220px, 1fr) minmax(180px, 1.5fr) 62px minmax(180px, 1.5fr); }
.columns-evidence { grid-template-columns: minmax(280px, 1.2fr) minmax(220px, 1.4fr) minmax(220px, 1.4fr); }

.row-name { display: flex; align-items: center; gap: 10px; }
.row-link { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.row-clickable:hover .row-link { color: #fff; }
.row-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.row-people { display: flex; }
.kind { flex: 0 100 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--faint); }
.table-note { padding: 8px; font-size: 12.5px; color: var(--faint); }

/* Service logos */
.logo { flex: none; width: 16px; height: 16px; background: var(--muted); -webkit-mask: var(--logo) center / contain no-repeat; mask: var(--logo) center / contain no-repeat; }
.logo-letter { flex: none; display: grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--line-strong); border-radius: 4px; font-size: 9px; font-weight: 600; color: var(--muted); }

/* Attacker active now: a pulsing red dot */
.pulse-dot { flex: none; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--crit); animation: pulse-dot 1.4s ease-out infinite; }
@keyframes pulse-dot {
  0% { box-shadow: 0 0 0 0 rgba(235, 87, 87, 0.7); }
  100% { box-shadow: 0 0 0 8px rgba(235, 87, 87, 0); }
}
@media (prefers-reduced-motion: reduce) { .pulse-dot { animation: none; } }
.active-now { display: flex; align-items: center; gap: 10px; margin: 12px 0 0; padding: 0 8px; font-weight: 500; color: var(--crit); }

/* ---------- Text you can type over ---------- */

[contenteditable] { border-radius: 4px; cursor: text; }
[contenteditable]:hover { background: rgba(255, 255, 255, 0.05); }
[contenteditable]:focus { background: rgba(124, 123, 255, 0.12); outline: none; }
[contenteditable][data-placeholder]:empty::before { content: attr(data-placeholder); color: var(--faint); font-weight: 400; }

/* ---------- Adding: the one line that opens under a "+" button ---------- */

.add-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: var(--row);
  padding: 0 8px;
  border-bottom: 1px solid var(--line);
  background: rgba(124, 123, 255, 0.07);
  box-shadow: inset 2px 0 0 var(--accent);
}
.add-row input { flex: 1; min-width: 0; height: 26px; padding: 0 6px; border: 0; border-radius: 4px; background: transparent; color: var(--text); }
.add-row input.short { flex: 0 0 240px; }
.add-row input:focus { outline: none; background: rgba(255, 255, 255, 0.05); }
.add-row input::placeholder { color: var(--faint); }

/* A list or a text with nothing in it is only a small "+" button. */
.quiet-adds { display: flex; flex-wrap: wrap; gap: 2px 6px; margin-top: 14px; }
.fields .quiet-adds { margin-top: 4px; }
.quiet-add { display: inline-flex; align-items: center; gap: 4px; height: 26px; padding: 0 8px 0 5px; margin-left: -5px; border: 0; border-radius: 6px; background: none; font-size: 12.5px; color: var(--faint); }
.quiet-add:hover { background: var(--hover); color: var(--text); }
.quiet-add .icon { width: 14px; height: 14px; }

/* ---------- Item pages: statuses, then the three texts ---------- */

.status-line { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 22px; margin: 0 0 10px; }
.status-line .logo, .status-line .logo-letter { width: 18px; height: 18px; margin-right: -12px; }
.status-line .kind { flex: none; }

.fields { display: grid; gap: 2px; margin-bottom: 4px; max-width: 980px; }
.field { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; align-items: baseline; }
.field-label { font-size: 12.5px; color: var(--faint); }
.field-value { display: block; min-height: 22px; padding: 2px 6px; margin-left: -6px; line-height: 1.45; }

/* ---------- The side panel ---------- */

.item-panel {
  position: fixed;
  z-index: 12;
  top: var(--topbar);
  right: 0;
  bottom: 0;
  width: min(460px, 100vw);
  padding: 0 20px 28px;
  overflow-y: auto;
  border-left: 1px solid var(--line-strong);
  background: var(--surface);
  box-shadow: -24px 0 48px rgba(0, 0, 0, 0.4);
  animation: panel-in 0.14s ease-out;
}
@keyframes panel-in {
  from { transform: translateX(24px); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .item-panel { animation: none; } }

.side-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; justify-content: space-between; height: 44px; margin: 0 -8px 4px; padding: 0 0 0 8px; background: var(--surface); }
.side-kind { font-size: 12.5px; color: var(--muted); }
.side-title { display: block; margin: 0 -6px; padding: 4px 6px; font-size: 15px; font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }

.props { display: grid; gap: 2px; margin: 12px 0 14px; }
.prop { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 8px; align-items: center; min-height: 30px; }
.prop-label { font-size: 12.5px; color: var(--faint); }
.prop-value { min-width: 0; display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--text); }
.prop-value .status { color: var(--text); }
.prop-text { min-width: 80px; padding: 2px 6px; margin-left: -6px; overflow-wrap: anywhere; }
.prop-link { overflow-wrap: anywhere; }
.prop-link:hover { color: var(--accent); }

.side-section { padding: 14px 0; border-top: 1px solid var(--line); }
.side-section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; margin-bottom: 6px; }
.side-section h3 { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.side-text { display: block; min-height: 22px; line-height: 1.5; overflow-wrap: anywhere; }
[contenteditable].side-text { margin: 0 -6px; padding: 3px 6px; }
[contenteditable].side-answer { min-height: 72px; margin: 0; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: rgba(0, 0, 0, 0.22); }
[contenteditable].side-answer:focus { border-color: var(--accent); background: rgba(0, 0, 0, 0.22); }
.side-quote { color: var(--muted); overflow-wrap: anywhere; }
div.side-quote { padding-left: 10px; border-left: 2px solid var(--line-strong); }
.side-note { margin-top: 8px; font-size: 12.5px; line-height: 1.5; color: var(--muted); overflow-wrap: anywhere; }
.side-note-label { margin-right: 8px; font-size: 12.5px; color: var(--faint); }
.side-note-warn { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; color: var(--crit); }
.side-note-warn .icon { width: 14px; height: 14px; }
.side-also { display: grid; gap: 4px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); line-height: 1.5; overflow-wrap: anywhere; }
.side-also .side-note-label { margin: 0; }
.side-section .item { margin: 0 -8px; }
.side-section .item:last-child { border-bottom: 0; }
.side-foot { padding-top: 14px; border-top: 1px solid var(--line); }

.source-link { display: inline-block; margin-top: 6px; font-size: 12.5px; color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.source-link:hover { color: var(--text); }
.side-also .source-link { margin-top: 0; }

/* ---------- Floating menus ---------- */

.picker {
  position: absolute;
  z-index: 30;
  min-width: 180px;
  max-width: 280px;
  padding: 4px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--raised);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
.menu-item { display: flex; align-items: center; gap: 8px; width: 100%; height: 30px; padding: 0 8px; border: 0; border-radius: 5px; background: none; color: var(--text); text-align: left; white-space: nowrap; }
.menu-item:hover { background: rgba(255, 255, 255, 0.07); }
.menu-item.active { background: rgba(255, 255, 255, 0.05); font-weight: 500; }
.menu-item-quiet { color: var(--muted); }
.menu-count { margin-left: auto; padding-left: 16px; font-size: 12px; color: var(--faint); }
.menu-label { padding: 6px 8px 2px; font-size: 11.5px; color: var(--faint); }
.menu-grid { display: grid; grid-template-columns: 1fr 1fr; }
.menu-form { padding: 4px; }
.menu-form input { width: 100%; height: 28px; padding: 0 8px; border: 1px solid var(--line-strong); border-radius: 5px; background: rgba(0, 0, 0, 0.3); color: var(--text); }
.menu-form input:focus { outline: none; border-color: var(--accent); }

/* ---------- Status summary: four slim counts, then the latest update ---------- */

#status-head { padding-top: 2px; }
.exec-counts { display: flex; flex-wrap: wrap; gap: 2px 28px; padding: 0 8px; }
.exec-count { display: inline-flex; align-items: baseline; gap: 7px; height: 26px; white-space: nowrap; }
.exec-count:hover .exec-count-label { color: var(--text); }
.exec-count-number { font-size: 17px; font-weight: 600; }
.exec-count.tone-crit .exec-count-number { color: var(--crit); }
.exec-count.tone-warn .exec-count-number { color: var(--warn); }
.exec-count.tone-ok .exec-count-number { color: var(--ok); }
.exec-count-label { font-size: 12.5px; color: var(--muted); }
.status-latest { height: 28px; border-top: 1px solid var(--line); }
.status-latest .item-note { max-width: 360px; }

/* The updates and next steps, in the side panel */
.side-head-actions { display: flex; gap: 2px; }
.item-panel .list { margin-top: 10px; }
.item-panel .list-head, .item-panel .item, .item-panel .add-row, .item-panel .exec-update { margin: 0 -8px; }
.item-panel .add-row { flex-wrap: wrap; height: auto; padding: 6px 8px; }
.item-panel .add-row input { flex: 1 1 100%; }
.item-panel .add-row input.short { flex: 1 1 120px; }

.exec-update { padding: 10px 8px; border-bottom: 1px solid var(--line); }
.exec-update-text { display: block; max-width: 110ch; margin: 0 -6px; padding: 2px 6px; line-height: 1.5; }
.exec-update-latest .exec-update-text { font-size: 15px; font-weight: 500; }
.exec-update-by { display: flex; align-items: center; gap: 8px; min-height: 26px; font-size: 12px; color: var(--faint); }

.exec-step-text { flex: 1 1 auto; min-width: 0; padding: 2px 6px; margin-left: -6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exec-step-note { min-width: 28px; padding: 2px 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
/* "Owner" and "When" are only hinted at while the pointer is on the row. */
.exec-step-note[data-placeholder]:empty::before { content: ""; }
.item:hover .exec-step-note[data-placeholder]:empty::before, .exec-step-note[data-placeholder]:focus:empty::before { content: attr(data-placeholder); }

/* ---------- Attack map ---------- */

.graph-card {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.055) 1px, transparent 0) 0 0 / 22px 22px,
    var(--canvas);
  overflow: hidden;
}
.graph-host { height: calc(100vh - 230px); min-height: 520px; cursor: grab; }
.graph-tools { position: absolute; z-index: 2; top: 10px; left: 10px; right: 10px; display: flex; justify-content: space-between; gap: 10px; pointer-events: none; }
.graph-tools .button { pointer-events: auto; background: var(--raised); }
.graph-zoom { display: flex; gap: 6px; }

.legend { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 8px 12px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 7px; }
.key { display: inline-block; width: 11px; height: 11px; border: 1.5px solid var(--muted); }
.key-system { border-radius: 50%; }
.key-credential { width: 9px; height: 9px; border: 0; background: var(--accent); transform: rotate(45deg); }
.key-data { border-radius: 3px; width: 13px; height: 10px; }
.key-line { display: inline-block; width: 20px; border-top: 1.5px solid var(--muted); }
.key-line.dashed { border-top-style: dashed; }

/* The panel for the selected node or line */
.graph-panel {
  position: absolute;
  z-index: 3;
  top: 48px;
  right: 10px;
  width: 272px;
  max-height: calc(100% - 100px);
  overflow-y: auto;
  padding: 12px;
  display: grid;
  gap: 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--raised);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.panel-title { font-size: 12px; color: var(--faint); }
.panel-input { width: 100%; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: rgba(0, 0, 0, 0.3); color: var(--text); resize: vertical; }
.panel-input:focus { outline: none; border-color: var(--accent); }
.panel-link { font-size: 12.5px; color: var(--accent); }
.panel-facts { display: grid; gap: 8px; padding: 8px 0 2px; border-top: 1px solid var(--line); }
.panel-statuses { display: grid; gap: 4px; }
.panel-text { line-height: 1.45; }
.graph-panel > .button { justify-content: flex-start; height: auto; min-height: 28px; padding: 4px 10px; white-space: normal; text-align: left; }
.graph-panel > .switch { justify-self: start; }

/* ---------- Search and filter lines ---------- */

.filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.search { flex: 1; min-width: 200px; height: 28px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 6px; background: rgba(255, 255, 255, 0.03); color: var(--text); }
.search::placeholder { color: var(--faint); }
.search:focus { outline: none; border-color: var(--accent); }
.filters + .list { margin-top: 0; border-top: 1px solid var(--line); }

/* ---------- Evidence ---------- */

.evidence-about { display: grid; gap: 2px; margin-bottom: 12px; max-width: 110ch; line-height: 1.5; color: var(--muted); }
.evidence-count { margin: 8px 0 6px; font-size: 12px; color: var(--faint); }
.evidence-scroll { overflow: auto; max-height: 70vh; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 6px; }
.evidence-table { border-collapse: collapse; font-size: 12.5px; width: max-content; min-width: 100%; }
.evidence-table th { position: sticky; top: 0; z-index: 1; padding: 7px 10px; border-bottom: 1px solid var(--line-strong); background: var(--surface); text-align: left; font-weight: 500; color: var(--muted); white-space: nowrap; }
.evidence-table td { max-width: 300px; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: top; }
.evidence-table .row-number { color: var(--faint); font-family: var(--mono); }
.evidence-row { cursor: pointer; }
.evidence-row:hover td { background: var(--hover); }
.evidence-row.selected td { background: rgba(124, 123, 255, 0.12); }
.detail { padding: 0 8px; }
.detail-line { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); line-height: 1.45; }
.detail-label { color: var(--muted); }
.detail-value { overflow-wrap: anywhere; }

/* ---------- Sign-in screen ---------- */

.login { min-height: 100vh; display: grid; place-items: center; padding: 20px 16px; }
.login-card { width: 100%; max-width: 360px; display: grid; gap: 20px; padding: 28px 24px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.login-card .brand { font-size: 15px; }
.login-form { display: grid; gap: 10px; }
.login-form label { color: var(--muted); }
/* 16px text stops phones from zooming in on the field. */
.login-form input { width: 100%; padding: 10px 12px; font: 16px var(--font); color: var(--text); border: 1px solid var(--line-strong); border-radius: 6px; background: rgba(0, 0, 0, 0.3); }
.login-form input:focus { outline: none; border-color: var(--accent); }
#login-code { font-family: var(--mono); letter-spacing: 0.3em; }
.login-form button[type="submit"] { padding: 10px 16px; border: 0; border-radius: 6px; background: var(--accent); color: #0b0b14; font-weight: 600; }
.login-form button[type="submit"]:hover { background: color-mix(in srgb, var(--accent) 85%, white); }
.login-form button:disabled { opacity: 0.6; cursor: default; }
.login-link { border: 0; background: none; padding: 4px 0; color: var(--muted); text-align: left; }
.login-link:hover { color: var(--text); }
.login-note { color: var(--text); }
.login-error { color: var(--crit); }

/* ---------- Narrow windows ---------- */

@media (max-width: 1000px) {
  :root { --gutter: 16px; }
  .updated { display: none; }
  .session { margin-left: auto; }
  .exec-counts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .item-where { max-width: 120px; }
  .field { grid-template-columns: 1fr; gap: 0; }
}

@media (max-width: 640px) {
  /* The top bar wraps and scrolls away, so nothing sticks under it. */
  :root { --topbar: 0px; }
  .topbar { position: static; height: auto; flex-wrap: wrap; gap: 6px 12px; padding: 8px 16px; }
  .nav { order: 3; width: 100%; }
  .header { flex-direction: column; align-items: flex-start; }
  .header-actions { justify-content: flex-start; }
  .item-where, .item-note { display: none; }
  .add-row input.short { flex-basis: 110px; }
}

/* ----- Follow up ----- */
.follow-flag { display: inline-flex; color: var(--warn); }
.follow-flag svg { width: 14px; height: 14px; }
.button-on { color: var(--warn); border-color: var(--warn); }
.group-head-plain { cursor: default; }

/* ----- Change log ----- */
.log-line { display: grid; grid-template-columns: 130px 220px minmax(200px, 1fr) minmax(0, 1.4fr); gap: 12px; align-items: baseline; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.log-when, .log-who { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-name { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-panel .log-line { grid-template-columns: 110px 1fr; padding: 6px 0; }
.item-panel .log-line .log-what { grid-column: 1 / -1; }
