/* Shared components: buttons, inputs, status, feedback. One idiom per job —
 * the predecessor mixed four (inline confirm, native confirm(), alert(),
 * toast); the new rule is: toast for results, two-step button for destroy
 * actions, no alert() anywhere. */

button {
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font: 12.5px var(--sans);
  padding: 5px 10px;
  cursor: pointer;
}
button:hover { border-color: var(--dim); }
button:disabled { opacity: .4; cursor: default; }

/* quiet icon/inline button */
button.ghost {
  background: transparent;
  border-color: transparent;
  color: var(--dim);
  padding: 4px 6px;
}
button.ghost:hover { color: var(--white); border-color: var(--line); }

/* dot-ghost (fleet head online/offline pair): dot + label on one line */
.dot-ghost { display: inline-flex; align-items: center; gap: 7px; }
.sec-head .ghost.on { background: var(--panel-2); color: var(--white); }

/* destructive two-step: first click arms ("sure?"), second fires */
button.arm { color: var(--bad); border-color: var(--bad); }

/* primary action — the near-white accent */
button.primary {
  background: var(--white);
  border-color: var(--white);
  color: #0a0a0a;
  font-weight: 600;
}
button.primary:hover { background: #fff; }

input[type=text], input[type=password], input[type=number], select {
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--text);
  font: 13px var(--sans);
  padding: 7px 9px;
  outline: none;
}
input:focus, select:focus { border-color: var(--dim); }

/* status dot — semantic only. live/offline/error states, nothing else. */
.dot {
  display: inline-block;
  width: 7px; height: 7px;
  border-radius: 50%;
  vertical-align: middle;
  background: var(--faint);
}
.dot.on  { background: var(--ok); }
.dot.off { background: #3a3a3a; }

/* country badge — regional-indicator emoji render as bare "US" text on some
 * Windows stacks, so flags are always a styled 2-letter code, never emoji */
.cc {
  display: inline-block;
  font: 600 10px/1 var(--mono);
  letter-spacing: .05em;
  color: var(--dim);
  border: 1px solid var(--line);
  padding: 2px 4px;
  margin-right: 6px;
}

/* label chip on agent rows */
.badge {
  display: inline-block;
  font-size: 10.5px;
  color: var(--dim);
  border: 1px solid var(--line);
  padding: 1px 6px;
  margin-left: 7px;
  vertical-align: 1px;
}

/* admin shield: bright border + white text, since elevation matters; the
 * `.no` variant is the standard-user chip — same shape, dimmed (every row
 * states its elevation, one way or the other) */
.shield {
  color: var(--white);
  font-size: 10.5px;
  border: 1px solid var(--line-strong);
  padding: 1px 6px;
  margin-left: 6px;
}
.shield.no { color: var(--faint); border-color: var(--line); }

/* kick chip in agent rows — the one host-affecting action; armed = red */
.jb {
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--dim);
  font: 10.5px/1 var(--sans);
  padding: 4px 8px;
  cursor: pointer;
}
.jb:hover:not(.arm) { color: var(--text); border-color: var(--faint); }

/* the kick's in-flight ring — replaces the word while the kick is queued;
 * 'kicked' is announced when the row actually leaves the list */
.k-spin {
  display: inline-block;
  width: 9px;
  height: 9px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: b-spin .8s linear infinite;
}

/* toast — the one feedback idiom */
#toast-wrap {
  position: fixed;
  right: 16px; bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 50;
}
.toast {
  background: var(--raised);
  border: 1px solid var(--line-strong);
  border-left: 2px solid var(--white);
  color: var(--text);
  font: 12.5px var(--sans);
  padding: 9px 12px;
  min-width: 220px;
  max-width: 380px;
  animation: toast-in .12s ease-out;
}
.toast.err { border-left-color: var(--bad); }
.toast.ok  { border-left-color: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(4px); } }

/* app-level error strip in the header */
#app-error {
  color: var(--bad);
  font-size: 12px;
}

/* terminal rows: white command echo, plain output */
#term-scroll .t-cmd { color: var(--white); margin-top: 7px; }
#term-scroll .t-cmd:first-child { margin-top: 0; }
#term-scroll .t-out { white-space: pre-wrap; }
#term-scroll .t-empty { color: var(--faint); }

/* ── segmented control (keylog view modes) ──────────────────────────────── */
.seg {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  background: var(--bg);
}
.seg-btn {
  background: transparent;
  border: none;
  border-right: 1px solid var(--line);
  color: var(--dim);
  font: 12px var(--sans);
  padding: 4px 10px;
  cursor: pointer;
}
.seg-btn:last-child { border-right: none; }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--raised); color: var(--white); }

/* ── keylog / clipboard blocks ───────────────────────────────────────────── */
/* 2026-11-06 keylog redesign: captures are LEDGER rows inside the day shell,
 * hairline-separated — not boxes in boxes. .k-sess is shared with the clip
 * pane, so the unboxing applies to both. */
.k-sess {
  background: transparent;
  margin-bottom: 0;
  border-bottom: 1px solid var(--line);
}
.k-sess:last-child { border-bottom: none; }
.k-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 10px 4px;
  font: 11px var(--mono);
  color: var(--faint);
}
.k-window {
  flex: 1;
  min-width: 0;
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.k-text {
  margin: 0;
  padding: 0 10px 8px;
  font: 12.5px/1.55 var(--mono);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
}
/* .k-none retired 2026-11-04: the creds view renders candidate-less sessions
 * not at all (operator ask) instead of a placeholder line per session. */

/* pane-local toolbar bits (2026-11-06): the creds page toggle + search box.
 * The seg/search hide while the creds page is up (keys.js sets hidden) — the
 * explicit display:none is load-bearing: .seg's layout display would defeat
 * the hidden attribute alone. */
#keys-toolbar { border-bottom: none; }
#keys-creds.on { background: var(--panel-2); color: var(--white); }
#keys-views[hidden], #keys-search[hidden] { display: none; }
#keys-search {
  width: 190px;
  height: 24px;
  padding: 0 8px;
  font: 11.5px var(--mono);
}

/* day drop-downs (2026-11-04 operator ask): every capture pane groups its
 * blocks by LOCAL day — today's day is open by default, older days collapse
 * until dropped down; open/close intent is recorded in a per-pane JS map so
 * the tail's re-render can't undo a manual expand */
.k-day {
  margin-bottom: 10px;
  border: 1px solid var(--line);
}
.k-day:last-child { margin-bottom: 0; }
.k-day > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  cursor: pointer;
  font: 11px var(--mono);
  letter-spacing: .06em;
  color: var(--faint);
  background: var(--panel);
}
/* the summary rule only separates when content follows — a collapsed shell
 * would show a double line against its own border otherwise */
.k-day[open] > summary { border-bottom: 1px solid var(--line); }
.k-day > summary::-webkit-details-marker { display: none; }
.k-day > summary:hover { color: var(--text); }
.k-caret {
  width: 0; height: 0;
  border-left: 4px solid currentColor;
  border-top: 3px solid transparent;
  border-bottom: 3px solid transparent;
  transition: transform .1s ease;
}
/* one anatomy, one open-rotation rule — the keys day-drop AND the downloads
 * ledger shell share .k-caret, so both rotate on open */
.k-day[open] > summary .k-caret,
.dl-day-g[open] > summary .k-caret { transform: rotate(90deg); }
.k-day-lbl { color: var(--dim); }
.k-day-n { margin-left: auto; color: var(--dim); }
.k-day-box { padding: 0; }                 /* the ledger sits flush: the
                                            * hairlines ARE the structure */
.k-copy { flex: 0 0 auto; padding: 2px 8px; cursor: pointer; }

/* char count chip */
.k-cc {
  flex: 0 0 auto;
  color: var(--faint);
  font: 10px/1 var(--mono);
}

/* cred count chip */
.k-ncreds {
  flex: 0 0 auto;
  font: 10px/1 var(--sans);
  padding: 2px 6px;
  border-radius: 2px;
  background: rgba(255, 220, 60, .12);
  border: 1px solid rgba(255, 220, 60, .35);
  color: #ffd93c;
  cursor: pointer;
  letter-spacing: .03em;
}
.k-ncreds:hover { background: rgba(255, 220, 60, .22); }

/* search match highlight */
mark.k-hl {
  background: rgba(255, 220, 60, .28);
  color: inherit;
  border-radius: 1px;
  padding: 0 1px;
}

/* pasted-marked stretches: subtle inline badge, never loud */
.k-paste {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: var(--dim);
  font: 10.5px/1 var(--sans);
  padding: 1px 5px 2px;
  margin: 0 3px;
  border-radius: 2px;
}

/* creds page (2026-11-06): one click-to-copy row per candidate — value left,
 * time/window trailing dim. The old typed/paste/acct chip row is gone; a
 * pasted candidate says it in the context line instead. */
button.k-cred {
  display: flex;
  align-items: baseline;
  gap: 12px;
  width: 100%;
  text-align: left;
  padding: 5px 10px;
  border: none;
  border-top: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
}
button.k-cred:first-child { border-top: none; }
button.k-cred:hover { background: var(--panel-2); }
.k-cred .k-val {
  flex: 0 1 auto;
  max-width: 62%;
  font: 12.5px var(--mono);
  color: var(--text);
  word-break: break-all;
}
button.k-cred:hover .k-val { color: var(--white); }
.k-cred .k-ctx {
  flex: 1;
  min-width: 0;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 10.5px var(--mono);
  color: var(--faint);
}

/* ── clipboard ledger (2026-11-06 redesign): ONE day-grouped ledger,
 * newest-first — the same-day hero pin was rejected by the operator (on real
 * data the newest copy repeated the first ledger row, twin re-captures
 * seconds apart, so the same text read twice glued at the top). Consecutive
 * duplicate captures collapse into one row with an .cl-xn chip. Rows are
 * hairline-separated, every row carries a copy button, and .cl-mark
 * brightens interesting tokens (urls, emails, wallet addrs). Long text
 * clamps behind a show-more; new rows flash once (brightness, never hue —
 * the theme law). */
.cl-badge {
  display: inline-block;
  background: var(--panel-2);
  border: 1px solid var(--line-strong);
  color: var(--dim);
  font: 10px/1 var(--sans);
  padding: 2px 5px;
  text-transform: uppercase;
  letter-spacing: .06em;
  border-radius: 2px;
}
.cl-badge[hidden] { display: none; }
.cl-row {                    /* relative: the show-more overlay anchors here */
  position: relative;
  border-top: 1px solid var(--line);
  padding: 7px 0 8px;
}
.cl-row:last-child { border-bottom: 1px solid var(--line); }
.k-day:last-child .cl-row:last-child { border-bottom: none; }
.cl-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
  font: 11px var(--mono);
  color: var(--faint);
}
.cl-ts { flex: 0 0 auto; }
.cl-win {
  flex: 1 1 auto;
  min-width: 60px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--dim);
}
.cl-len { flex: 0 0 auto; color: var(--faint); }
.cl-xn {
  flex: 0 0 auto;
  color: var(--faint);
  font: 10px/1 var(--sans);
  border: 1px solid var(--line);
  padding: 1px 4px;
  border-radius: 2px;
}
.cl-text {
  margin: 0;
  font: 12.5px/1.55 var(--mono);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 132px;
  overflow: hidden;
}
.cl-row.cl-open .cl-text { max-height: none; }
.cl-row.cl-open .cl-more { display: none; }
/* show-more OVERLAYS the clamped text bottom instead of following it in
 * flow — an in-flow button is attached AFTER the anchor measure (wireClMores
 * is rAF-deferred: a detached row measures 0px tall), which under-restored
 * the prepend scroll anchor ~19px per clamped row; the clamp fades instead. */
.cl-more {
  position: absolute;
  left: 0;
  bottom: 0;
  display: block;
  background: transparent;
  border: none;
  color: var(--dim);
  font: 10.5px var(--mono);
  padding: 2px 0;
  cursor: pointer;
  text-align: left;
}
.cl-more:hover { color: var(--text); }
.cl-row:not(.cl-open):has(> .cl-more) .cl-text {
  -webkit-mask-image: linear-gradient(
      to bottom, #000 0, #000 calc(100% - 30px), transparent 100%);
  mask-image: linear-gradient(
      to bottom, #000 0, #000 calc(100% - 30px), transparent 100%);
}
.cl-mark { color: var(--white); }
.cl-flash { animation: clFlash 1.2s ease-out; }
@keyframes clFlash {
  from { background: rgba(255, 255, 255, .09); }
  to   { background: transparent; }
}
/* ── file manager pane ───────────────────────────────────────────────────── */
#fm-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);   /* the toolbar rides above BOTH bodies — */
                              /* one quiet surface, not see-through rows */
}
#fm-toolbar button { flex: 0 0 auto; white-space: nowrap; }
#fm-crumb {
  flex: 1;
  min-width: 0;
  font: 12px var(--mono);
  color: var(--dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#fm-crumb a { color: var(--dim); text-decoration: none; cursor: pointer; }
#fm-crumb a:hover { color: var(--text); }
#fm-crumb .cur { color: var(--white); cursor: default; }
#fm-crumb .sep { color: var(--faint); }

.fm-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 5px 6px;
  font: 12.5px var(--mono);
  color: var(--text);
  border-bottom: 1px solid var(--line);
}
.fm-row:hover { background: var(--panel); }
.fm-row .fm-glyph { flex: 0 0 auto; color: var(--faint); align-self: center; }
.fm-row.dir .fm-glyph { color: var(--dim); }
.fm-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fm-row.dir .fm-name { color: var(--white); cursor: pointer; }
.fm-row.hidden-row .fm-name { color: var(--faint); }
.fm-row.hidden-row:hover .fm-name { color: var(--dim); }
.fm-size { flex: 0 0 auto; width: 78px; text-align: right; color: var(--dim); }
.fm-time { flex: 0 0 auto; width: 118px; text-align: right; color: var(--faint); font-size: 11.5px; }
.fm-info { flex: 0 0 auto; color: var(--faint); font-size: 11.5px; }
.fm-act { display: flex; gap: 6px; flex: 0 0 auto; }
/* ghost verbs: quiet text in the act column — the pill-in-row skin is gone;
 * the arm state is plain red text (the 'sure?' label does the rest) */
.fm-act button {
  background: transparent;
  border: none;
  color: var(--faint);
  font: 10.5px/1 var(--sans);
  padding: 2px 4px;
  cursor: pointer;
}
.fm-act button:hover { color: var(--text); }
.fm-act button.arm { color: var(--bad); }
.fm-empty { color: var(--faint); font: 12px var(--sans); padding: 7px 6px; }

/* ── downloads view — the files pane's second body ─────────────────────────
 * NOT a zone at the bottom: the toolbar's 'history' button swaps the pane
 * body between the file list and this view (operator-driven). LEDGER shape
 * (2026-11-11, "nicer, more organized"): a column-aligned header line, active
 * transfers pinned under it (bright state text + full-width progress strip on
 * the row's bottom hairline), finished transfers in borderless day sections —
 * name · size · state line, then the path-led info line that copies. */
#fm-dl {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
/* author display:flex kills the [hidden] attribute (the .pane gotcha) */
#fm-dl[hidden] { display: none; }
#fm-hist.on { background: var(--panel-2); color: var(--white); }
/* dl stats ride the toolbar's #fm-dl-count chip next to the crumb (the old
 * #fm-dl-head row removed 2026-11-02: a full-height strip holding one faint
 * word read awkward) */
#fm-dl-count {
  color: var(--faint);
  font: 11px var(--mono);
  white-space: nowrap;
}
/* live = active transfers exist in the FILE view: bright + clickable (the
 * one-click door into history). NO display rule here — the [hidden]
 * attribute must keep working (the .pane authored-flex gotcha). */
#fm-dl-count.live { color: var(--text); cursor: pointer; }
#fm-dl-count.live:hover { color: var(--white); }
#fm-dl-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 8px 14px 10px;
}
/* the ledger's column tracks — ONE var so the header line and every row
 * line up exactly (the action track is FIXED: a max-content track on an
 * empty header cell collapses to 0 and de-aligns the header from rows) */
#fm-dl { --dl-cols: minmax(0, 1fr) 62px 110px 86px; }
.dl-row {
  display: grid;
  grid-template-columns: var(--dl-cols);
  gap: 10px;
  align-items: center;
  position: relative;          /* the progress strip anchors to the row box */
  padding: 6px 2px 5px;
  font: 12px var(--mono);
}
.dl-row.on { border-bottom: 1px solid var(--line); }
.dl-row:hover { background: var(--panel); }
/* status tick: the 2px edge IS the row's state at the same hairline scale
 * as the strip — white = live, red = failed, transparent = calm history */
.dl-row::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: transparent;
}
.dl-row.on::before { background: var(--white); }
.dl-row.failed::before { background: var(--bad); }
.dl-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}
.dl-size {
  min-width: 62px;
  text-align: right;
  font-size: 11px;
  color: var(--dim);
}
.dl-stat {
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  text-align: right;   /* the chip hugs the act column — no hole mid-track */
  font: 11.5px var(--sans);
}
/* .dl-chip kept its NAME for the patch path + probe, but holds no box any
 * more — a plain text state token. Next reader: do NOT re-add borders. */
.dl-chip {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--faint);
  font: 11px var(--mono);
}
/* active = bright (the mono-noir brightness ladder); failed = the alarm */
.dl-chip.live { color: var(--text); }
.dl-chip.bad  { color: var(--bad); }
.dl-chip.done { color: var(--ok); }
/* full-width progress strip riding the row's bottom hairline (its track) */
.dl-line {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  display: block;
  pointer-events: none;
}
.dl-line .fill {
  display: block;
  height: 100%;
  background: var(--white);   /* the accent is --white in this mono-noir language */
  transition: width .3s linear;
}
.dl-act { justify-self: end; white-space: nowrap; }
/* the action is an <a> (download streams from the server) or a <button> —
   one skin. text-decoration:none without this reads blue/underlined */
.dl-act a, .dl-act button {
  display: inline-block;
  text-decoration: none;
  background: transparent;
  border: none;
  color: var(--dim);
  font: 11px var(--mono);
  padding: 0;
  cursor: pointer;
}
.dl-act a:hover, .dl-act button:hover { color: var(--white); }
/* the ledger header: one column-aligned line above the day groups — the
 * single loudest "organized" cue (a transfer ledger, not a text dump) */
/* Ledger width cap: on a ~1900px pane the 1fr name column opens a ~1500px
 * void between the file and its metadata — the whole ledger caps at a human
 * reading width, left-anchored (the toolbar/crumb language). Rows inside a
 * day shell inherit the shell's width. */
#fm-dl-cols {
  display: grid;
  grid-template-columns: var(--dl-cols);
  gap: 10px;
  max-width: 640px;
  /* fixed margins ONLY — an auto cross margin on a flex item disables
   * stretch and the header collapses to fit-content (~380px, misaligned) */
  margin: 0 14px;
  padding: 8px 0 7px;   /* x-padding zeroed: header rect = 1080px = exactly
                         * the borderless day groups below (the probe's
                         * shellErr assert measures BOTH) */
  border-bottom: 1px solid var(--line);
  font: 10.5px var(--mono);
  letter-spacing: .08em;
  color: var(--faint);
}
#fm-dl-body > * { max-width: 640px; }
#fm-dl-cols .r { text-align: right; }
/* finished entries close with their info line — that line IS the entry's
 * hairline (a border on the row too would draw a double rule). The path
 * leads (it's the payload); time · agent ride faint behind it. */
.dl-sub {
  padding: 0 2px 5px;
  border-bottom: 1px solid var(--line);
  font: 11px var(--mono);
  color: var(--faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: copy;
}
.dl-sub:hover { background: var(--panel); }
.dl-sub-p { color: var(--dim); }    /* the path — the payload — leads brighter */
.dl-sub-m { color: var(--faint); }
.dl-row.failed .dl-name { color: var(--dim); }   /* readable, not struck */
/* day sections: borderless — the previous section's close + the caret
 * summary line ARE the boundary (no shell box wrapped around a day) */
.dl-g-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 2px;
  font: 11px var(--mono);
  letter-spacing: .06em;
  color: var(--faint);
}
.dl-day-g {
  margin: 12px 0 0;
}
.dl-day-g > summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 2px;
  cursor: pointer;
  font: 11px var(--mono);
  letter-spacing: .06em;
  color: var(--faint);
}
.dl-day-g > summary::-webkit-details-marker { display: none; }
.dl-day-g > summary:hover { color: var(--text); }
.dl-day-lbl { color: var(--dim); }
.dl-day-n { margin-left: auto; color: var(--dim); }
/* NO horizontal padding: the rows inside a shell must land on the SAME
 * column tracks as the header line and the pinned active rows above */
.dl-g-rows { padding: 0 0 4px; }
.dl-none { color: var(--faint); font: 11.5px var(--sans); padding: 4px 6px 6px; }

/* ── modal — the ONE dialog idiom ──────────────────────────────────────────
 * Modal cards are server-rendered in dashboard.html, display:none while at
 * rest; ui.js moves the card into the shared #modal-backdrop on open. */
#modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .64);
  z-index: 40;
  display: grid;
  place-items: center;
}
#modal-backdrop[hidden] { display: none; }
.modal { display: none; }
#modal-backdrop .modal {
  display: block;
  width: min(430px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  padding: 20px 22px;
  font-family: var(--sans);
}
.modal h3 {
  margin: 0 0 16px;
  font: 600 14.5px var(--sans);
  color: var(--white);
}
.modal .m-row { margin-bottom: 13px; }
.modal label {
  display: block;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0 0 5px;
}
.modal input[type=text], .modal input[type=password], .modal input[type=number] {
  width: 100%;
  box-sizing: border-box;
}
.m-pair { display: flex; gap: 12px; margin-bottom: 13px; }
.m-pair > div { flex: 1; min-width: 0; }
/* Number inputs (port, interval): strip the native spinner chrome. */
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
input[type=number] { -moz-appearance: textfield; appearance: textfield; }

.m-check {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 12px 0 0;
  cursor: pointer;
  user-select: none;
}
/* Custom checkbox: native input invisible but still focusable (space toggles,
   label clicks route through it) — the painted box mirrors its state. */
.m-check input { position: absolute; opacity: 0; pointer-events: none; }
.m-check .cbox {
  flex: 0 0 15px;
  width: 15px; height: 15px; box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--line-strong);
  color: #0a0a0a;
  display: inline-flex; align-items: center; justify-content: center;
}
.m-check .cbox svg { display: none; }
.m-check:hover .cbox { border-color: var(--dim); }
.m-check input:checked + .cbox { background: var(--white); border-color: var(--white); }
.m-check input:checked + .cbox svg { display: block; }
.m-check input:focus-visible + .cbox { outline: 1px solid var(--dim); outline-offset: 2px; }
.m-check .c-lbl {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  color: var(--text);
}
.m-check .c-ico { color: var(--dim); flex: 0 0 auto; }
.modal .m-note {
  font: 12px/1.5 var(--mono);
  color: var(--dim);
  margin-top: 14px;
  min-height: 18px;
  white-space: pre-wrap;
}
.modal .m-note.bad { color: var(--bad); }
.modal .m-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}
/* input + button on one line (agent-key copy row) */
.m-inline {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.m-inline input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 12px; }
.m-inline button { white-space: nowrap; }
/* the eye that unmasks a secret row (legacy key / discord webhook) */
.m-inline .eye {
  flex: 0 0 auto;
  align-self: center;
  color: var(--dim);
  padding: 6px;
}
.m-inline .eye:hover { color: var(--text); border-color: transparent; }
/* destructive modal action — color only where the arm idiom already went red */
.m-actions button.bad:hover { color: var(--bad); border-color: var(--bad); }

/* settings modal views: the seg under the h3 switches general ↔ crypto
 * clipper; save/note stay shared below the swapped sections. */
#set-modes { margin-bottom: 16px; }

/* ── per-build list (settings modal) ──────────────────────────────────────
 * One row per compiled exe: output name (the build's handle), how many
 * agents enrolled on it, when, and its 2-step revoke. Revoked rows keep
 * their place but go dim — the row is history, the hash is what matters. */
.builds {
  border: 1px solid var(--line);
  background: var(--bg);
  max-height: 150px;
  overflow-y: auto;
}
.b-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 9px;
  border-bottom: 1px solid var(--line);
}
.b-row:last-child { border-bottom: none; }
.b-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 12px var(--mono);
  color: var(--text);
}
.b-n { flex: 0 0 auto; font: 11.5px var(--sans); color: var(--dim); }
.b-n svg { vertical-align: -1.5px; margin-right: 3px; }
.b-time { flex: 0 0 auto; font: 10.5px var(--mono); color: var(--faint); }
.b-state { flex: 0 0 auto; font: 10.5px var(--sans); color: var(--faint); letter-spacing: .04em; }
.b-row.building .b-name { color: var(--dim); }
/* compile spinner — hairline track, silver head; the state slot for building */
.b-spin {
  flex: 0 0 auto;
  align-self: center;
  width: 11px;
  height: 11px;
  border: 2px solid var(--line-strong);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: b-spin .8s linear infinite;
}
@keyframes b-spin { to { transform: rotate(360deg); } }
.b-revoke {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--dim);
  font: 10.5px/1 var(--sans);
  padding: 2px 7px;
  cursor: pointer;
}
.b-revoke:hover { color: var(--bad); border-color: currentColor; }
.b-dl {
  flex: 0 0 auto;
  background: transparent;
  border: 1px solid var(--line-strong);
  color: var(--dim);
  border-radius: 3px;
  font: 11px var(--sans);
  padding: 2px 7px;
  cursor: pointer;
}
.b-dl:hover { color: var(--text); border-color: currentColor; }
.b-tleft {
  flex: 0 0 auto;
  font: 11px var(--mono);
  color: var(--dim);
  min-width: 30px;   /* m:ss never reflows the row as digits change */
}
.b-row.dead .b-name, .b-row.dead .b-n, .b-row.dead .b-time { color: var(--faint); }
.b-none { font: 12px var(--sans); color: var(--faint); padding: 6px 9px; }

/* "builds done" tick over the topbar build button (white dot + count) */
.n-badge {
  position: absolute;
  top: -4px;
  right: -5px;
  min-width: 13px;
  height: 13px;
  padding: 0 3px;
  border-radius: 7px;
  background: var(--text);
  color: #0a0a0a;
  font: 700 9px/13px var(--sans);
  text-align: center;
}
#btn-build { position: relative; }
.n-badge[hidden] { display: none; }

/* small count next to the legacy-key label */
.set-count { text-transform: none; letter-spacing: 0; color: var(--faint); margin-left: 4px; }

/* ── the right-click launcher (ctx.js) ────────────────────────────────────
 * ONE agent context menu, the former bottom drawer's replacement: monitoring
 * (sub: screen viewer / keylog viewer / clipboard), terminal, files, then a
 * divider and the label/kick pair. Flat panel + hairline, hover brightens;
 * the submenu opens right-edge-aware. Native browser menu stays on inputs. */
#ctx-menu {
  position: fixed;
  z-index: 60;
  min-width: 200px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  padding: 3px 0;
  display: flex;
  flex-direction: column;
  font: 12.5px var(--sans);
  user-select: none;
}
#ctx-menu[hidden] { display: none; }
#ctx-menu .ctx-head {
  padding: 2px 14px 7px;
  color: var(--faint);
  font: 11px var(--mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* wrapper holds a top-level item and — when it has one — its submenu, so a
 * hover crossing from the item into the sub never leaves the wrapper */
.ctx-wrap { position: relative; }
.ctx-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  background: transparent;
  border: none;
  color: var(--dim);
  font: inherit;
  text-align: left;
  padding: 6px 14px;
  cursor: pointer;
}
.ctx-item:hover { background: var(--panel-2); color: var(--white); }
.ctx-item.arm { color: var(--bad); }
.ctx-item .sub-arrow { flex: 0 0 auto; margin-left: 12px; color: var(--faint); }
.ctx-wrap.open .ctx-item { background: var(--panel-2); color: var(--white); }
.ctx-sub {
  position: absolute;
  top: -3px;
  left: 100%;
  min-width: 172px;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  padding: 3px 0;
  display: none;
}
.ctx-wrap.open .ctx-sub { display: block; }
/* not enough room to the right (menu opened near the screen's right edge) —
 * ctx.js flips the submenu to the menu's left side */
#ctx-menu.edge-flip .ctx-sub { left: auto; right: 100%; }
.ctx-sub .ctx-item { padding-left: 16px; }
.ctx-sep { border-top: 1px solid var(--line); margin: 3px 0; }

/* ── fleet table view states (agents.js) ───────────────────────────────────── */
#agents-table thead th.sortable { cursor: pointer; user-select: none; }
#agents-table thead th.sortable:hover { color: var(--dim); }
#agents-table thead th.sort-asc::after  { content: ' \2191'; }
#agents-table thead th.sort-desc::after { content: ' \2193'; }
#fleet-online.on { color: var(--ok); border-color: var(--ok); }

/* queued beacon special in the terminal input row */
.q-chip {
  color: var(--warn);
  font: 11px var(--mono);
  padding-left: 10px;
  white-space: nowrap;
}

/* new-agent arrival: a brief bright settle, brightness not hue (tokens law) */
@keyframes rowFlash {
  from { background: rgba(245, 245, 245, .13); }
  to   { background: transparent; }
}
#agents-table tbody tr.f-new td { animation: rowFlash 3.5s ease-out; }
