/* miau web UI
   Served from the hub's own binary. No external fonts, no CDN -- the content
   security policy allows same-origin only, and the UI must work on a LAN with
   no internet access.

   The palette is the one from mikuni.dev. That site loads no web fonts either,
   so it came over without a single external request being added. */

:root {
  /* Five surface levels, darkest first. Every panel in the UI sits on exactly
     one of them, which is what keeps a card readable as an object. */
  --bg: #0a0612;
  --bg-sunken: #110a1f;
  --bg-raised: #1a0f2e;
  --surface: #1e1334;
  --surface-2: #261942;

  --border: #3a2660;
  --border-strong: #553a8a;

  --text: #e8e0ff;
  --text-dim: #a89ccc;
  /* Lifted from the site's #6e6190, which reaches only 3.3:1 on a card. On
     the site it carries small print; here it carries when a server was last
     seen. #9084b5 clears 4.5:1 on all five surfaces above. */
  --text-faint: #9084b5;

  /* Brand. Pink is reserved for the wordmark and for security updates -- if
     it also tinted buttons and headings it would stop meaning anything. */
  --pink: #ff4fa3;
  --pink-soft: #ff7ebd;
  --violet: #a070ff;
  --cyan: #5ce1ff;
  --cyan-soft: #8ee9ff;
  --grad: linear-gradient(135deg, #ff4fa3 0%, #a070ff 50%, #5ce1ff 100%);

  /* Semantic state. The site has no green/amber/red; these are picked at the
     same saturation and lightness as the brand colours so they belong. */
  --accent: #a070ff;      /* selected, primary                               */
  --busy: #5ce1ff;        /* a job is running                                */
  --ok: #4ee6a8;
  --warn: #ffc24f;
  --danger: #ff5f52;
  --danger-soft: #ff8b82;
  --security: #ff4fa3;
  /* Cyan rather than violet: the ring has to stay visible on a selected card,
     whose border is already --accent. */
  --focus: #8ee9ff;

  --font: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: ui-monospace, "JetBrains Mono", "Fira Code", "SF Mono", Menlo, Consolas, monospace;

  --radius: 10px;         /* buttons, inputs                                 */
  --radius-lg: 14px;      /* cards, panels, dialogs                          */
  --radius-sm: 7px;       /* badges, tags, log wells                         */
}

* { box-sizing: border-box; }

/* Keyboard focus. Everything reachable by Tab has to be visibly reachable,
   including the controls that used to be plain divs. :focus-visible keeps the
   ring off mouse clicks, where it reads as a stuck selection. */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 3px;
}

/* Visible to a screen reader, not on screen. Used for the live-region label
   and the dialog hints that would be noise for a sighted reader. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

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

[hidden] { display: none !important; }

/* --- login ---------------------------------------------------------------- */

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 340px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 24px;
}

.login-card h1 {
  margin: 0 0 4px;
  font-size: 19px;
  font-weight: 600;
}

.login-card p.sub {
  margin: 0 0 22px;
  color: var(--text-dim);
  font-size: 13px;
}

label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

input[type="password"], input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  margin-bottom: 16px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
}

/* Same token as the generic rule above, which this one outranks on
   specificity. Two different ring colours -- --accent on controls, --focus
   on links and <summary> -- is a difference nobody meant. */
input:focus-visible, button:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 1px;
}

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

button {
  font: inherit;
  font-weight: 500;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 7px 13px;
  cursor: pointer;
}

button:hover:not(:disabled) { border-color: var(--border-strong); }
button:hover:not(:disabled) { background: #2e1f4e; }
button:disabled { opacity: 0.4; cursor: not-allowed; }

/* The gradient carries dark text, not white. White over the violet in the
   middle of the gradient is 3.4:1; #0a0612 is 5.6:1 there and 12.3:1 at the
   cyan end. */
button.primary {
  background: var(--grad);
  border-color: transparent;
  color: var(--bg);
  font-weight: 650;
}
button.primary:hover:not(:disabled) {
  background: var(--grad);
  box-shadow: 0 0 22px rgba(255, 79, 163, .30);
}

/* No glow on the dangerous ones. The pink glow pulls the eye, which is the
   one thing "upgrade everything" and "reboot" must not do. */
button.danger { border-color: rgba(255, 95, 82, .38); color: var(--danger-soft); background: rgba(255, 95, 82, .10); }
button.danger:hover:not(:disabled) { background: rgba(255, 95, 82, .18); border-color: rgba(255, 95, 82, .70); box-shadow: none; }

button.wide { width: 100%; }
button.sm { padding: 4px 9px; font-size: 12px; }
button.ghost { background: none; border-color: transparent; color: var(--text-dim); }
button.ghost:hover:not(:disabled) { background: var(--bg-raised); color: var(--text); }

/* --- layout --------------------------------------------------------------- */

header.top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 10px 20px;
  background: rgba(17, 10, 31, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.brand {
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.spacer { flex: 1; }

.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-dim);
}

.dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
  flex: none;
}
.dot.live { background: var(--ok); box-shadow: 0 0 8px rgba(78, 230, 168, 0.45); }
.dot.busy { background: var(--busy); box-shadow: 0 0 8px rgba(92, 225, 255, 0.45); }
.dot.off  { background: var(--danger); }

main { padding: 18px 20px 60px; }

/* --- fleet toolbar -------------------------------------------------------- */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  margin-bottom: 18px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.toolbar .scope {
  font-size: 12px;
  color: var(--text-dim);
  margin-right: 4px;
}
.toolbar .scope strong { color: var(--text); font-weight: 600; }

/* --- summary -------------------------------------------------------------- */

.panel {
  margin-bottom: 18px;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.panel > summary {
  padding: 11px 14px;
  cursor: pointer;
  font-weight: 600;
  font-size: 13px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel > summary::-webkit-details-marker { display: none; }
.panel > summary::before {
  content: "▸";
  color: var(--security);
  font-size: 10px;
}
.panel[open] > summary::before { content: "▾"; }
.panel > summary:hover { background: var(--surface-2); }

.panel-body { padding: 4px 14px 14px; border-top: 1px solid var(--border); }

.pkg-row {
  display: grid;
  grid-template-columns: minmax(140px, 1.2fr) auto minmax(0, 2fr) auto;
  gap: 10px;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px solid rgba(58, 38, 96, 0.55);
  font-size: 13px;
}
.pkg-row:last-child { border-bottom: none; }
.pkg-name { font-family: var(--mono); font-size: 12.5px; }
.pkg-hosts { color: var(--text-dim); font-size: 12px; }

.count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 8px;
  white-space: nowrap;
}

/* --- server grid ---------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 14px;
}

.card {
  display: flex;
  flex-direction: column;
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.12s;
}
.card:hover { border-color: var(--border-strong); }
.card.selected { border-color: var(--accent); background: #1d1136; }
.card.offline { opacity: 0.78; }
.card.offline .card-name { color: var(--text-dim); }
.card.running { border-color: rgba(92, 225, 255, 0.55); }

.card-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px 9px;
  cursor: pointer;
}

/* A real <button>, because opening a server was mouse-only before. The reset
   keeps the card head's flex layout exactly as it was: dot, name, spacer,
   checkbox -- min-width:0 is what lets the ellipsis still work inside flex. */
/* button:hover sets a background and a border; these two look like text, so
   they have to beat it on specificity rather than rely on the reset above. */
.card-head .card-name:hover:not(:disabled),
.failbar .fail-link:hover:not(:disabled) {
  background: none;
  border-color: transparent;
  text-decoration: underline;
}

.card-name {
  font-weight: 600;
  font-size: 14px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
  font-family: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.card-sub {
  padding: 0 13px 9px;
  font-size: 11.5px;
  color: var(--text-faint);
  display: flex;
  flex-wrap: wrap;
  gap: 4px 10px;
}

.badges { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 13px 10px; }

.badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  white-space: nowrap;
}
.badge.updates  { color: var(--warn); border-color: rgba(255, 194, 79, 0.35); background: rgba(255, 194, 79, 0.10); }
/* Security is the one thing in this grid worth a glow. */
.badge.security { color: var(--pink-soft); border-color: rgba(255, 79, 163, 0.45); background: rgba(255, 79, 163, 0.14);
                  box-shadow: 0 0 14px rgba(255, 79, 163, 0.16); }
.badge.reboot   { color: #ffd98a; border-color: rgba(255, 194, 79, 0.55); background: rgba(255, 194, 79, 0.20); font-weight: 600; }
.badge.clean    { color: var(--ok); border-color: rgba(78, 230, 168, 0.32); background: rgba(78, 230, 168, 0.09); }
.badge.locked   { color: var(--text-dim); border-color: var(--border-strong); }
.badge.muted    { color: var(--text-faint); border-color: var(--border); }
/* Entfernbar: Cyan statt Bernstein. Es ist keine Arbeit, die ansteht -- es ist
   Ballast, der weg koennte, und das soll nicht wie eine Faelligkeit aussehen. */
.badge.removable { color: var(--cyan-soft); border-color: rgba(92, 225, 255, 0.40);
                   background: rgba(92, 225, 255, 0.10); }
/* Not an error and not an update -- this host wants the installer run on it.
   Violet, like the hub badge: both are about the machinery rather than the
   packages. */
.badge.reinstall { color: var(--violet); border-color: rgba(160, 112, 255, 0.5);
                   background: rgba(160, 112, 255, 0.14); font-weight: 600; }

/* mini log */
.minilog {
  margin: 0 13px 11px;
  padding: 8px 10px;
  height: 104px;
  overflow: hidden;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 11px;
  line-height: 1.45;
  color: var(--text-dim);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  cursor: pointer;
}
.minilog .ln { white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.minilog .empty { color: var(--text-faint); font-style: italic; font-family: inherit; }

.ln.stderr { color: var(--danger-soft); }
.ln.agent  { color: var(--cyan-soft); }

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 13px 13px;
  margin-top: auto;
}

.jobstate {
  padding: 0 13px 11px;
  font-size: 11.5px;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 7px;
}

/* Job state marks. These used to be inline style attributes, which the
   content security policy refuses -- so they rendered in the inherited grey
   and a failure looked like an idle host. */

.jl-idle { color: var(--text-faint); }
.jl-ok   { color: var(--ok); }
.jl-warn { color: var(--warn); }
.jl-bad  { color: var(--danger); }

.spin {
  width: 10px; height: 10px;
  border: 2px solid rgba(92, 225, 255, 0.22);
  border-top-color: var(--busy);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  flex: none;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- overlay / modal ------------------------------------------------------ */

.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 2, 12, 0.78);
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal {
  width: 100%;
  max-width: 980px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}

.modal.narrow { max-width: 440px; }

.modal-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
}
.modal-head h2 { margin: 0; font-size: 16px; font-weight: 700; }

.modal-body { padding: 16px; overflow: auto; }
.modal-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
}

.fulllog {
  height: 46vh;
  min-height: 240px;
  overflow: auto;
  padding: 10px 12px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.5;
}
.fulllog .ln { white-space: pre-wrap; word-break: break-word; }

.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px 18px;
  margin-bottom: 14px;
  font-size: 13px;
}
.meta-grid dt { color: var(--text-faint); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.meta-grid dd { margin: 2px 0 0; font-family: var(--mono); font-size: 12.5px; }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.tab {
  padding: 7px 12px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  color: var(--text-dim);
  font-size: 13px;
}
.tab.active { color: var(--text); border-bottom-color: var(--security); }

table.list { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.list th {
  text-align: left;
  padding: 6px 8px;
  color: var(--text-faint);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid var(--border);
}
table.list td { padding: 6px 8px; border-bottom: 1px solid rgba(58, 38, 96, 0.55); font-family: var(--mono); font-size: 12px; }
table.list tr:last-child td { border-bottom: none; }

.code {
  display: block;
  padding: 11px 13px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-family: var(--mono);
  font-size: 12.5px;
  word-break: break-all;
  user-select: all;
}

.bigcode {
  font-family: var(--mono);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-align: center;
  padding: 16px;
  margin-bottom: 14px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  user-select: all;
}

.note { font-size: 12.5px; color: var(--text-dim); margin: 12px 0 0; }
.note.warn {
  color: var(--warn);
  border-left: 2px solid rgba(255, 194, 79, 0.5);
  padding-left: 10px;
}

ul.targets { margin: 10px 0 0; padding-left: 20px; font-size: 13px; color: var(--text-dim); max-height: 180px; overflow: auto; }

/* --- the removal list in the cleanup dialog -------------------------------- */

ul.pkglist { list-style: none; padding-left: 0; max-height: 46vh; }
.pkghost + .pkghost { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.pkghost-name {
  display: flex; align-items: baseline; gap: 10px;
  font-weight: 650; color: var(--text); font-size: 13.5px; margin-bottom: 7px;
}
.pkghost-when { font: 11px/1 var(--mono); color: var(--text-faint); font-weight: 400; }
.pkghost-none { font-size: 12.5px; color: var(--text-faint); font-style: italic; }
.pkgnames { display: flex; flex-wrap: wrap; gap: 5px; }
.pkgname {
  font: 11.5px/1 var(--mono);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  color: var(--danger-soft);
  background: rgba(255, 95, 82, 0.09);
  border: 1px solid rgba(255, 95, 82, 0.28);
}

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

#toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}

.toast {
  padding: 10px 13px;
  background: var(--bg-raised);
  border: 1px solid var(--border-strong);
  border-left: 3px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 13px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}
.toast.err { border-left-color: var(--danger); }
.toast.ok  { border-left-color: var(--ok); }

.empty-state {
  padding: 56px 20px;
  text-align: center;
  color: var(--text-dim);
}
.empty-state h2 { color: var(--text); font-size: 17px; margin: 0 0 8px; }

@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
  header.top { padding: 10px 13px; }
  main { padding: 14px 13px 50px; }
}

/* language switch ---------------------------------------------------------- */

.langbar { display: inline-flex; gap: 2px; }

.langbar button {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  background: none;
  border: 1px solid transparent;
  color: var(--text-faint);
  border-radius: var(--radius-sm);
}
.langbar button:hover:not(.on) { color: var(--text); background: var(--bg-raised); }
.langbar button.on {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--bg-sunken);
}

.login-card .langbar {
  margin-top: 18px;
  justify-content: center;
  width: 100%;
}

/* pairing dialog ----------------------------------------------------------- */

label.spaced { margin-top: 20px; }

details.sums { margin-top: 8px; }
details.sums > summary {
  cursor: pointer;
  font-size: 11.5px;
  color: var(--text-faint);
  list-style: none;
}
details.sums > summary::-webkit-details-marker { display: none; }
details.sums > summary::before { content: "▸ "; }
details.sums[open] > summary::before { content: "▾ "; }
details.sums > summary:hover { color: var(--text-dim); }
details.sums .code {
  margin-top: 6px;
  font-size: 11px;
  line-height: 1.6;
  color: var(--text-dim);
}

/* the hub's own machine --------------------------------------------------- */

.badge.ishub { color: var(--violet); border-color: rgba(160, 112, 255, 0.45); background: rgba(160, 112, 255, 0.12); }

/* The one machine whose reboot throws you out of this page. It gets the
   gradient, as the only card that does. */
.card.ishub { position: relative; }
.card.ishub::before {
  content: "";
  position: absolute;
  inset: -1px -1px auto -1px;
  height: 2px;
  background: var(--grad);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

/* copy-to-clipboard rows ---------------------------------------------------- */

.copyrow { display: flex; gap: 6px; align-items: stretch; }
.copyrow .code { flex: 1; min-width: 0; }
.copyrow .copy { flex: none; align-self: stretch; white-space: nowrap; }
.copyrow .copy.done { border-color: var(--ok); color: var(--ok); }

/* recurring checks ---------------------------------------------------------- */

.routine {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) auto minmax(0, 2fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid rgba(58, 38, 96, 0.55);
  font-size: 13px;
}
.routine:last-of-type { border-bottom: none; }
.routine .rname { font-weight: 600; }
.routine .rwhen { color: var(--text-dim); font-size: 12px; }
.routine .ractions { display: flex; gap: 6px; justify-content: flex-end; }
.routine.off .rname, .routine.off .rwhen { opacity: 0.5; }

.rform {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: flex-end;
}
.rform .field { display: flex; flex-direction: column; gap: 4px; }
.rform input[type="text"], .rform select {
  margin: 0;
  padding: 7px 9px;
  background: var(--bg-sunken);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}
.rform label { margin: 0; }

.rtargets {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  padding: 10px 0 2px;
  font-size: 12.5px;
}
.rtargets label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 12.5px;
  color: var(--text);
  font-weight: 400;
}

/* security-only upgrade ----------------------------------------------------- */

button.security { border-color: rgba(255, 79, 163, 0.40); color: var(--pink-soft); background: rgba(255, 79, 163, 0.10); }
button.security:hover:not(:disabled) {
  background: rgba(255, 79, 163, 0.18);
  border-color: var(--security);
  box-shadow: 0 0 16px rgba(255, 79, 163, 0.25);
}

/* how long an upgrade has been waiting -------------------------------------- */

.since { font-size: 11.5px; color: var(--text-faint); white-space: nowrap; }
.since.old { color: var(--warn); }

/* tags ---------------------------------------------------------------------- */

.tagbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-bottom: 14px;
  padding: 0 2px;
}
.tagbar .label { font-size: 12px; color: var(--text-faint); margin-right: 2px; }

.tag {
  font-size: 11.5px;
  padding: 2px 9px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--text-dim);
  cursor: pointer;
}
.tag:hover { color: var(--text); border-color: var(--border-strong); }
.tag.on { color: var(--cyan-soft); border-color: rgba(92, 225, 255, 0.45); background: rgba(92, 225, 255, 0.10); }
.tag .n { color: var(--text-faint); margin-left: 4px; }

.card-tags { display: flex; flex-wrap: wrap; gap: 4px; padding: 0 13px 9px; }
.card-tags .tag { cursor: default; font-size: 11px; padding: 1px 7px; }

/* failures ------------------------------------------------------------------ */

.failbar {
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(255, 95, 82, 0.10);
  border: 1px solid rgba(255, 95, 82, 0.40);
  border-radius: var(--radius-lg);
  font-size: 13px;
}
.failbar .head { font-weight: 600; color: var(--danger-soft); margin-bottom: 6px; }
.failbar ul { margin: 0; padding-left: 18px; }
.failbar li { padding: 2px 0; color: var(--text-dim); }
.failbar a:hover { border-bottom-color: var(--text); }

/* navigation ---------------------------------------------------------------- */

.nav {
  display: flex;
  gap: 2px;
  margin-left: 8px;
}

.navlink {
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  border: 1px solid transparent;
}
.navlink:hover { color: var(--text); background: var(--bg-raised); }
.navlink.on {
  color: var(--text);
  background: var(--bg-sunken);
  border-color: var(--border-strong);
}
.navlink .pip {
  display: inline-block;
  min-width: 16px;
  margin-left: 6px;
  padding: 0 4px;
  border-radius: var(--radius-sm);
  background: var(--border-strong);
  color: var(--text);
  font-size: 10.5px;
  text-align: center;
}
.navlink .pip.alert { background: rgba(255, 95, 82, 0.22); color: var(--danger-soft); }

/* views --------------------------------------------------------------------- */

.viewtitle {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.viewlead {
  margin: 0 0 18px;
  max-width: 70ch;
  font-size: 13px;
  color: var(--text-dim);
}

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

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}

.setcard {
  background: var(--bg-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
}
.setcard h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}
.setcard dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; }
.setcard dt { color: var(--text-faint); font-size: 12.5px; }
.setcard dd {
  margin: 0;
  font-family: var(--mono);
  font-size: 12px;
  word-break: break-word;
}
.setcard .note { margin-top: 10px; }
.setcard .code { margin-top: 8px; }

/* Links inside body copy. Without this they fall back to the browser's
   default blue, which on a dark background is barely readable. */

.note a, .viewlead a, .panel-body a {
  color: var(--cyan-soft);
  text-decoration: none;
  border-bottom: 1px solid rgba(92, 225, 255, 0.4);
}
.note a:hover, .viewlead a:hover, .panel-body a:hover {
  border-bottom-color: var(--cyan-soft);
}

.pill {
  display: inline-block;
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  border: 1px solid;
  font-family: inherit;
  font-size: 11.5px;
}
.pill.yes { color: var(--ok); border-color: rgba(78, 230, 168, 0.32); background: rgba(78, 230, 168, 0.09); }
.pill.no  { color: var(--text-dim); border-color: var(--border-strong); }

/* footer -------------------------------------------------------------------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 16px 20px 22px;
  margin-top: 30px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-faint);
}
.foot a { color: var(--text-dim); text-decoration: none; border-bottom: 1px solid var(--border-strong); }
.foot a:hover { color: var(--text); border-bottom-color: var(--text-dim); }
.foot .sep { opacity: 0.5; }

@media (max-width: 640px) {
  .nav { margin-left: 0; width: 100%; overflow-x: auto; }
  .foot { padding: 14px 13px 20px; }
}

/* The failure bar's server link was an <a> with no href: it looked like a
   link, took a click, and was invisible to the keyboard. Now a button that
   still looks like a link. */
.fail-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--danger-soft);
  text-decoration: underline;
  cursor: pointer;
}
