:root {
  --bg: #10131a;
  --panel: #171b24;
  --panel-2: #1d222d;
  --line: #2a3140;
  --line-strong: #3a4356;
  --text: #e6e9ef;
  --muted: #8b94a7;
  --head: #ccd4e3;    /* headings + form labels: brighter than muted, quieter than text */
  --accent: #5b9dff;
  --ok: #3ecf8e;
  --warn: #f0b429;
  --bad: #f2695c;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
}

body.centered {
  display: grid;
  place-items: center;
  min-height: 100vh;
}

h1 { font-size: 20px; margin: 0 0 16px; }
/* Panel titles are the landmarks the eye navigates by, so they read as headings —
   bright and heavier — rather than blending into the muted metadata around them. */
h2 { font-size: 13.5px; margin: 0 0 12px; color: var(--head); font-weight: 700;
     text-transform: uppercase; letter-spacing: .08em; }

a { color: var(--accent); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  min-width: 300px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Form labels answer "what goes in this box" — they must be findable before the box is. */
label { font-size: 12.5px; font-weight: 600; color: var(--head); margin-top: 8px; }

input, select, textarea, button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
textarea { min-height: 76px; resize: vertical; font-family: ui-monospace, monospace; font-size: 12px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* Three ranks of button, and the rank must read before the text does: filled accent
   acts, outlined acts nearby, red-tinged destroys. */
button {
  background: var(--accent);
  border-color: transparent;
  color: #08111f;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  padding: 9px 14px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .35);
}
button:hover:not(:disabled) { filter: brightness(1.1); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .55; cursor: default; box-shadow: none; }
button.secondary {
  background: var(--panel-2); color: var(--text); border-color: var(--line-strong);
  font-weight: 600; margin-top: 0; box-shadow: none;
}
button.secondary:hover:not(:disabled) { border-color: var(--accent); filter: none; }
button.small { padding: 6px 12px; font-size: 12.5px; margin-top: 0; }

.error { color: var(--bad); font-size: 13px; margin: 10px 0 0; }
.muted { color: var(--muted); }

/* --- shell ---------------------------------------------------------------- */
/* Rail + one content column. The rail exists so that moving between views keeps the
   WebSocket and the device map alive; farm-monitor's page-per-device links tear both
   down on every hop. */

:root { --rail: #0b0e14; --line-soft: #212734; --dim: #626c80; --accent-dim: #23405f; }

.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }
@media (max-width: 820px) { .shell { grid-template-columns: 1fr; } }

.rail {
  background: var(--rail);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 0 14px;
  position: sticky;
  top: 0;
  height: 100vh;
}
@media (max-width: 820px) { .rail { position: static; height: auto; } }

.brand { padding: 0 20px 20px; display: flex; flex-direction: column; gap: 3px; }
.brand-mark {
  font-size: 18px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase;
  color: var(--text);
}
.brand-sub {
  font: 11.5px/1.4 ui-monospace, monospace; color: var(--dim); letter-spacing: .04em;
}

.nav-group { padding: 12px 12px 2px; }
.nav-group[hidden] { display: none; }
.nav-group-label {
  font: 11px/1 ui-monospace, monospace; text-transform: uppercase; letter-spacing: .12em;
  color: var(--dim); padding: 0 8px 9px;
}

.nav-item {
  display: flex; align-items: center; gap: 11px; width: 100%;
  padding: 11px 12px; margin: 0 0 3px;
  background: none; border: 0; border-radius: 8px;
  color: var(--muted); font: 500 14.5px/1 inherit;
  cursor: pointer; text-align: left;
  box-shadow: none;
}
.nav-item:hover { background: var(--panel); color: var(--text); }
/* The current view is answered by shape (the accent bar), not only by shade — two
   greys a step apart is not an answer at a glance. */
.nav-item[aria-current="true"] {
  background: var(--panel-2); color: var(--text); font-weight: 600;
  box-shadow: inset 3px 0 0 var(--accent);
}
.nav-item[aria-current="true"] .nav-icon { color: var(--accent); }
.nav-item[aria-current="true"] .nav-count { color: var(--accent); }
.nav-icon { width: 18px; height: 18px; flex: none; color: var(--dim); }
.nav-count {
  margin-left: auto; font: 12.5px/1 ui-monospace, monospace; color: var(--dim);
  font-variant-numeric: tabular-nums;
}

.rail-foot { margin-top: auto; padding: 16px 20px 0; border-top: 1px solid var(--line-soft); }
.health { display: flex; flex-direction: column; gap: 8px; }
.health-row {
  display: flex; align-items: center; gap: 8px;
  font: 12.5px/1 ui-monospace, monospace; color: var(--muted);
}
.health-row b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

.content { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 15px 24px; border-bottom: 1px solid var(--line);
  background: var(--panel); position: sticky; top: 0; z-index: 5;
}
.topbar h1 {
  margin: 0; font-size: 18px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase;
}
.topbar .sub { font: 13px/1 ui-monospace, monospace; color: var(--dim); }
.topbar .grow { flex: 1; }
.topbar button { margin-top: 0; }

/* Views are siblings that share the socket; only one is on at a time. */
.view { display: none; padding: 20px 24px 48px; }
.view.on { display: block; }

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
  align-items: start;
}
@media (max-width: 1000px) { .split { grid-template-columns: minmax(0, 1fr); } }

/* A view whose server side does not exist yet says so, rather than showing a shape
   that implies working buttons. */
.panel.soon { border-style: dashed; max-width: 72ch; }
.panel.soon p { color: var(--muted); margin: 0 0 10px; }
.panel.soon p:last-child { margin-bottom: 0; }
.panel.soon b { color: var(--warn); font-weight: 600; }

section.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
}

/* --- table --- */

.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--head); font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
tbody tr:hover { background: var(--panel-2); }
tbody tr.selected { background: #1b2740; }
td.name { font-weight: 600; white-space: normal; }

.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }
/* The halo makes online/offline scannable down a column without reading anything. */
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(62, 207, 142, .16); }
.dot.off { background: #55607a; }

.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-weight: 600;
  font-size: 11px; border: 1px solid var(--line); background: var(--panel-2); color: var(--muted);
}
.pill.pending { color: var(--warn); border-color: #4a3d1a; }
.pill.dispatched { color: var(--accent); border-color: #23405f; }
.pill.done { color: var(--ok); border-color: #1d4638; }
.pill.failed, .pill.expired { color: var(--bad); border-color: #4d2622; }
.pill.canceled { color: var(--muted); }
/* A phone dropping off is worth noticing but is not an error — dimmer than failed. */
.pill.k-off { color: #c99f9a; border-color: #443038; }

code { font-family: ui-monospace, monospace; font-size: 12px; color: var(--muted); }
td.mono, .mono { font-family: ui-monospace, monospace; font-size: 12px; }
.mask { color: var(--dim); letter-spacing: .1em; }
.bad { color: var(--bad); }
/* Destructive is a look, not just a word: red border and a faint red fill, so Delete
   can never be mistaken for the neutral button beside it. */
button.danger {
  color: var(--bad);
  border-color: rgba(242, 105, 92, .5);
  background: rgba(242, 105, 92, .08);
}
button.danger:hover:not(:disabled) { background: rgba(242, 105, 92, .16); border-color: var(--bad); }
tbody tr.off td { opacity: .55; }
tbody tr.badline td { color: var(--bad); }

/* --- accounts ------------------------------------------------------------- */
/* Picker beside the table rather than a dropdown above it: which phone you are editing is
   the thing most worth having in view at all times on this screen, since every edit here
   is scoped to one handset. */

.acct-grid {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 1000px) { .acct-grid { grid-template-columns: minmax(0, 1fr); } }

.phone-pick { display: flex; flex-direction: column; gap: 4px; }
.pick {
  display: flex; align-items: center; gap: 6px;
  margin: 0; padding: 7px 10px; text-align: left;
  background: transparent; border: 1px solid transparent; border-radius: 8px;
  color: var(--muted); font-weight: 500; box-shadow: none;
}
.pick:hover { background: var(--panel-2); color: var(--text); }
.pick.on { background: var(--panel-2); border-color: var(--accent-dim); color: var(--text); }
.pick-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pick-n { font-size: 11px; color: var(--dim); font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 0 0 12px; }
.tab {
  margin: 0; padding: 6px 12px; border-radius: 8px;
  background: transparent; border: 1px solid var(--line);
  color: var(--muted); font-weight: 500; box-shadow: none;
}
.tab:hover { color: var(--text); }
.tab[aria-selected="true"] {
  background: var(--panel-2); color: var(--text); font-weight: 600;
  border-color: var(--accent);
}
.tab .n { font-variant-numeric: tabular-nums; color: var(--dim); font-size: 12px; }
.tab[aria-selected="true"] .n { color: var(--accent); }
.tab-pending { color: var(--warn); margin-left: 4px; }

.runbar {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 12px; margin-bottom: 12px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
}
.runbar .grow { flex: 1; }
.chain { font-size: 12px; line-height: 1.6; color: var(--muted); }
.chain b { color: var(--text); font-family: ui-monospace, monospace; font-weight: 600; }

.selbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px; margin-bottom: 12px;
  background: #1b2740; border: 1px solid var(--accent-dim); border-radius: 10px;
  font-size: 13px;
}
.selbar .grow { flex: 1; }
.selbar label.inline { margin: 0; font-size: 12px; }
.selbar select { padding: 4px 8px; font-size: 12px; }

/* A switch rather than a checkbox: the row already has a checkbox for selection, and two
   identical controls a column apart doing unrelated things is a click waiting to go
   wrong. */
.sw {
  position: relative; width: 34px; height: 18px; padding: 0; margin: 0;
  border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line);
  cursor: pointer; box-shadow: none;
}
.sw::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--dim); transition: left .12s, background .12s;
}
.sw[aria-checked="true"] { background-color: #14322a; border-color: #1d4638; }
.sw[aria-checked="true"]::after { left: 18px; background: var(--ok); }
.sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.addrow { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.addrow input { flex: 1; min-width: 280px; font-family: ui-monospace, monospace; font-size: 12px; }
.fmt { font-size: 12px; color: var(--dim); margin: 8px 0 0; }
.fmt b { color: var(--muted); font-family: ui-monospace, monospace; font-weight: 600; }
.fmt.bad { color: var(--bad); }
.fmt.bad b { color: var(--bad); }

.bulk {
  margin-top: 14px; padding: 14px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
}
.bulk[hidden] { display: none; }
.bulk textarea { width: 100%; min-height: 120px; }
.bulk .scroll { max-height: 300px; overflow-y: auto; margin-top: 10px; }

/* --- vault ---------------------------------------------------------------- */

/* Counts above the table, because "how many are tagged NSFW" is the question this view
   exists to answer at a glance — the table answers "which ones". */
.strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px; margin-bottom: 16px;
}
.stat {
  display: flex; flex-direction: column; gap: 2px;
  padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
}
.stat-k { font-size: 11px; color: var(--dim); text-transform: uppercase; letter-spacing: .06em; }
.stat-v { font-size: 22px; font-weight: 600; font-variant-numeric: tabular-nums; }
.stat-v.ok { color: var(--ok); }
.stat-v.warn { color: var(--warn); }
.stat-v.bad { color: var(--bad); }

/* A consequence, stated where the decision is made. Amber rather than red: this is a rule
   to follow, not an error that has happened. */
.note {
  display: block; margin-top: 14px; padding: 10px 12px;
  background: #241d0d; border: 1px solid #4a3d1a; border-radius: 10px;
  font-size: 13px; color: #e8d9b0;
}
.note[hidden] { display: none; }
.note b { color: var(--warn); }
.note code { color: #e8d9b0; }

#vaultLog { max-height: 200px; }

.row { display: flex; gap: 8px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 4px; }

.log { max-height: 260px; overflow-y: auto; font-family: ui-monospace, monospace; font-size: 12px; }
.log div { padding: 3px 0; border-bottom: 1px solid var(--line); }

.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 16px; z-index: 20; max-width: 90vw;
}
.toast.bad { border-color: var(--bad); color: var(--bad); }
.toast.good { border-color: var(--ok); }

.codeblock {
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; font-family: ui-monospace, monospace; font-size: 13px;
  word-break: break-all; user-select: all;
}

/* --- capture gallery ------------------------------------------------------- */
/* Thumbnails are deliberately small: a full-screen iPhone capture is ~4 MB and
   1125x2436, so shown at natural size one image would fill the panel and push
   everything else off screen. */
.gallery {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}
.shot {
    margin: 0;
    width: 104px;
}
.shot img {
    width: 104px;
    height: 150px;
    object-fit: cover;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg);
    display: block;
}
.shot figcaption {
    color: var(--muted);
    font-size: 11px;
    margin-top: 4px;
    text-align: center;
}
.filebox {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 104px;
    height: 150px;
    border: 1px dashed var(--line);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 11px;
    text-align: center;
    padding: 6px;
    overflow-wrap: anywhere;
    text-decoration: none;
}
.filebox:hover { border-color: var(--accent); }

/* Live screen: the stage and the phone's own feed, side by side. One height variable for
   both halves, because two independent heights drift the moment either changes. */
.live-split {
    --live-h: 60vh;
    /* The label row above each box. Both cells have one and both boxes are
       --live-h minus it, which is the whole reason the picture and the feed line up
       top and bottom — three places used to compute that height separately.
       42px leaves the (grown) small button ~33px of room inside the 36px the row
       has after its padding, so a different font metric cannot clip Clear. */
    --live-head: 42px;
    --live-box: calc(var(--live-h) - var(--live-head));
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}
/* min-width:0 — without it a grid item refuses to shrink below its content, and one long
   unbroken feed line pushes the stage out of the panel. */
.live-cell { position: relative; min-width: 0; }

/* The picture is scaled to fit (rfb.scaleViewport), so a narrower column costs resolution
   rather than cropping. Below this width the two halves stack instead: side-by-side on a
   phone-sized browser would leave neither half usable. */
@media (max-width: 900px) {
    .live-split { grid-template-columns: 1fr; }
    .live-split { --live-h: 50vh; }
}

/* noVNC reads clientWidth/clientHeight off this container to size its canvas, so it must
   have real dimensions before the RFB object is constructed — an auto-height div collapses
   to 0 and renders a blank panel. A phone screen is tall and narrow, hence the portrait
   aspect. */
.vnc-stage {
    position: relative;
    width: 100%;
    height: var(--live-box, 60vh);
    min-height: 288px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #000;
    overflow: hidden;
}

/* Shown while the stage is hidden. Same box, so starting a stream does not reflow the row. */
.vnc-idle {
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    height: var(--live-box, 60vh);
    min-height: 288px;
    padding: 0 24px;
    border: 1px dashed var(--line);
    border-radius: 6px;
    background: var(--bg);
}
.vnc-idle[hidden] { display: none; }
.vnc-idle p { margin: 6px 0 0; font-size: 12px; max-width: 34ch; }

/* --- the phone's feed ----------------------------------------------------- */

/* Fixed height rather than "whatever the label needs": it is one half of the arithmetic
   that keeps the two boxes level, so it must not depend on what is written in it. */
.feed-head {
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--live-head, 34px);
    padding-bottom: 6px;
    overflow: hidden;
}
/* Scoped like every other .grow in this file: the rule is per-container, not global. */
.feed-head .grow { flex: 1; }
.feed-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--muted);
}
.feed {
    /* Same box as the stage opposite it — see --live-box. */
    height: var(--live-box, 60vh);
    min-height: 288px;
    overflow-y: auto;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--bg);
    padding: 4px 0;
    font-family: ui-monospace, monospace;
    font-size: 12px;
}
.feed-line {
    display: flex;
    gap: 8px;
    padding: 4px 10px 4px 8px;
    border-left: 2px solid transparent;
    overflow-wrap: anywhere;
}
.feed-line + .feed-line { border-top: 1px solid var(--line); }
.feed-line .t { color: var(--muted); flex: 0 0 auto; font-variant-numeric: tabular-nums; }
/* Kind is the script's own verdict on what it just did, and it is the reason to look at
   this panel at all — an error two hundred lines back should be findable by colour. */
.feed-line.good  { border-left-color: var(--ok); }
.feed-line.warn  { border-left-color: var(--warn); }
.feed-line.error { border-left-color: var(--bad); background: rgba(242, 105, 92, .08); }
.feed-line.error .msg { color: var(--bad); }
.feed-empty { padding: 10px; color: var(--muted); font-family: inherit; }

/* --- content sheet -------------------------------------------------------- */
/* A modal over the accounts table rather than a route: the sheet is about one row of the
   table behind it, and losing that context to a page navigation is what makes farm-monitor's
   per-device pages tiring to work in. */

.sheet-wrap {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(6, 8, 12, .72);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 32px 16px; overflow-y: auto;
}
.sheet-wrap[hidden] { display: none; }

.sheet {
  width: 100%; max-width: 860px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px;
  display: flex; flex-direction: column;
}
.sheet.confirm { margin-top: 16px; border-color: var(--accent-dim); }
.sheet[hidden] { display: none; }

.sheet-head {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--line);
}
.sheet-head h2 { margin: 0 0 2px; }
.sheet-body { padding: 18px; display: flex; flex-direction: column; gap: 18px; }
.sheet-foot {
  display: flex; align-items: center; gap: 8px;
  padding: 14px 18px; border-top: 1px solid var(--line);
}

.field-block { display: flex; flex-direction: column; gap: 6px; }
.field-block[hidden] { display: none; }
.field-block > label { margin: 0; font-size: 12px; color: var(--muted); }
.field-block textarea { width: 100%; }

/* Subreddit chips: the tag is already the 18+ decision, so it is shown on the chip rather
   than left to be remembered from the vault. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  margin: 0; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 500;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted);
  box-shadow: none;
}
.chip:hover { color: var(--text); }
.chip.on { background: #1b2740; border-color: var(--accent); color: var(--text); }
.chip.over18 { border-style: dashed; }
.chip.over18.on { background: #2e1a1a; border-color: var(--bad); color: #ffd9d4; }

.media-list { display: flex; flex-direction: column; gap: 6px; }
.media-row {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 10px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px; font-size: 13px;
}
.media-n {
  width: 20px; flex: none; text-align: center;
  color: var(--dim); font-variant-numeric: tabular-nums; font-size: 12px;
}
.media-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.media-row input[type="datetime-local"] { padding: 3px 6px; font-size: 12px; }

.picker {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 4px;
  max-height: 200px; overflow-y: auto;
  padding: 8px; background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 8px;
}
.pick-row { display: flex; align-items: center; gap: 6px; margin: 0; font-size: 13px; color: var(--text); }

.swipe-fields { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.swipe-fields[hidden] { display: none; }
.swipe-fields input { width: 62px; padding: 4px 6px; font-size: 12px; }

/* The live summary. Counts first, then anything blocking, then anything merely worth
   knowing — so the reason a save is refused is never below the fold. */
.plan-summary { display: flex; flex-direction: column; gap: 3px; font-size: 12px; min-width: 0; }
.plan-count { font-weight: 600; color: var(--text); }
.plan-bad { color: var(--bad); margin: 0; }
.plan-note { color: var(--warn); }
.warnText { color: var(--warn); }
.en { color: var(--ok); font-weight: 600; }

/* farm-monitor's purple, kept so the button means the same thing in both dashboards. */
button.multi { background: #8b5cf6; color: #fff; border-color: transparent; }

/* --- the model library ---------------------------------------------------- */
/* The tiles are the picker, so "ticked" has to read at a glance across a grid of twenty. */
.shot.picked img, .shot.picked .filebox { outline: 2px solid var(--accent); outline-offset: 2px; }
.shot.picked figcaption { color: var(--accent); }
/* The remove button sits on the tile rather than under it: a row of × buttons below a grid is
   one mis-click away from deleting the wrong file. */
.shot { position: relative; }
.tile-x {
  position: absolute; top: 2px; right: 2px;
  padding: 0 6px; line-height: 18px; min-width: 0;
  opacity: 0; transition: opacity .12s;
}
.shot:hover .tile-x, .tile-x:focus { opacity: 1; }

/* The Editing stage's avatar row: the preview, its name, and the way to drop it, on one line
   because an avatar is one file and a stacked layout would imply a list. */
.avatar-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-height: 34px; }
.avatar-preview {
  width: 56px; height: 56px; border-radius: 50%;
  object-fit: cover; border: 1px solid var(--line);
}

/* Two ways to put a file in — an upload or a library — on one line, because they are alternatives
   rather than steps. */
.source-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 6px; }
.source-row input[type=file] { flex: 0 1 auto; }

/* --- files ---------------------------------------------------------------- */

/* A check runs on every selected phone at once and each answers separately, so the results
   are a list that fills in — not a toast, which would show one phone's answer and drop the
   other seven. Same line shape as the phone's feed, without its stage-matched height. */
.results {
  max-height: 260px; overflow-y: auto; margin-top: 10px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--bg);
  padding: 4px 0; font-family: ui-monospace, monospace; font-size: 12px;
}
.results[hidden] { display: none; }
.res-line { display: flex; gap: 8px; padding: 5px 10px 5px 8px; border-left: 2px solid transparent; }
.res-line + .res-line { border-top: 1px solid var(--line); }
.res-line .who { color: var(--muted); flex: 0 0 auto; }
.res-line .msg { overflow-wrap: anywhere; }
.res-line.pending .msg { color: var(--muted); }
.res-line.done { border-left-color: var(--ok); }
.res-line.failed { border-left-color: var(--bad); }
.res-line.failed .msg { color: var(--bad); }

/* Disk held against the budget the sweep enforces. A bar rather than two numbers because the
   only thing worth knowing at a glance is how close it is, and 6.1 / 8.0 GB does not read as
   "nearly full" the way three quarters of a bar does. */
.bar {
  height: 6px; margin-top: 6px; border-radius: 3px;
  background: var(--panel-2); overflow: hidden;
}
.bar > span { display: block; height: 100%; background: var(--accent); }
.bar > span.warn { background: var(--warn); }
.bar > span.bad { background: var(--bad); }

/* Phone chips: the same fleet selection Phone Manager's checkboxes drive, editable where a
   collection is actually decided. A wrapping row rather than the accounts view's vertical
   list, because this sits inside a panel that already has a form under it. */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  margin: 0; padding: 5px 10px;
  font-size: 12px; font-weight: 500;
  background: var(--panel); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  box-shadow: none;
}
.chip:hover { background: var(--panel-2); color: var(--text); }
/* Ticked has to read across twenty of them at a glance — this is the control that decides
   which handsets get pulled from, so "which ones are on" must never need a second look. */
.chip.on {
  background: var(--panel-2); color: var(--text);
  border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent-dim);
}
.chip .dot { margin: 0; }

/* Two buttons in the fleet table's last cell. Kept on one line and out of the way: the row is
   scanned for state, not for controls, so the actions must not compete with the status. */
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.row-actions button { margin: 0; }

/* --- users ---------------------------------------------------------------- */
/* Accounts and the fleet's ownership, side by side: assigning is the reason this
   view exists, so neither half should have to scroll past the other. */
.duo {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
@media (max-width: 1100px) { .duo { grid-template-columns: minmax(0, 1fr); } }

/* --- logs ----------------------------------------------------------------- */
/* The one cell allowed to wrap: a command error is a sentence, and nowrap would put
   the whole table on one 2000px line for it. */
td.log-detail { white-space: normal; overflow-wrap: anywhere; min-width: 220px; }
