/* server.css — the agent's server: Settings → Agent server, and its validity
   under Settings → Payments. The common section / form vocabulary
   lives in sections.css. */

/* ── Server info grid (key/value pairs) ─────────────────────────── */
.grid2 {
  display: grid;
  grid-template-columns: minmax(110px, max-content) minmax(0, 1fr);
  row-gap: .45rem;
  column-gap: 1rem;
  font-size: .82rem;
}
.grid2 > div:nth-child(odd)  { color: var(--muted); white-space: nowrap }
.grid2 > div:nth-child(even) { color: var(--text); font-family: var(--mono); font-size: .78rem; word-break: break-all; min-width: 0 }

.state-ok   { color: var(--accent) }
.state-warn { color: var(--warn) }
.state-err  { color: var(--err) }

@media (max-width: 680px) {
  .grid2 { grid-template-columns: minmax(90px, max-content) minmax(0, 1fr) }
}

/* ── Agent server ───────────────────────────────────────────────────
   Plain cards: how the machine is doing and what it is, how to reach it
   over SSH, and (as categories of their own) the file manager and the
   terminal. None folds away, so none has a header bar. */
section.panel-section.server-card {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  /* A wide tool (the switch, a long path) scrolls inside the card. */
  min-width: 0;
  max-width: 100%;
  padding: 1.25rem;
  border: 1px solid var(--border2);
  border-radius: 14px;
  background: var(--card);
}
/* Every way of hiding a section has to outweigh the display above: the
   focus of a pinned card (shell.css: .panel-section[data-focus-hidden]) is
   one class lighter, so it is restated here. */
section.panel-section.server-card[hidden],
section.panel-section.server-card[data-search-hidden],
section.panel-section.server-card[data-focus-hidden] { display: none }
.server-card > * { min-width: 0 }
.server-foot {
  padding-top: 1.15rem;
  border-top: 1px solid var(--border);
}
.server-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem 1rem;
}
/* What the server is paid for is Payments' to tell; here it is one line
   and the way there. */
.server-validity {
  margin: 0;
  color: var(--muted);
  font-size: .82rem;
}
.server-validity a {
  margin-left: .5rem;
  color: var(--text);
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--border2);
  text-underline-offset: 3px;
}
.server-validity a:hover { text-decoration-color: currentColor }
.server-validity a[hidden] { display: none }
.server-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem 1.1rem;
}
/* Deleting is Your agent's to do (the button is there); here it is the way
   there, a link like Payments', in the danger's colour. */
.server-delete-link {
  color: var(--danger-action);
  font-size: .82rem;
  font-weight: 500;
  text-decoration: underline;
  text-decoration-color: var(--border2);
  text-underline-offset: 3px;
}
.server-delete-link:hover { text-decoration-color: currentColor }

/* ── Server validity (Settings → Payments) ────────────────────────── */
.validity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem 1rem;
}
.lifetime-state {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--text);
}
.lifetime-state.warn { color: var(--warn) }
.lifetime-state.danger,
.lifetime-state.critical { color: var(--err) }
.lifetime-paid {
  margin-top: .2rem;
  color: var(--muted);
  font-size: .82rem;
}
/* Close to running out, the card says so with its border too. */
.lifetime-section.danger,
.lifetime-section.critical { border-color: color-mix(in srgb, var(--err) 45%, transparent) }

/* ── Automatic-updates rows (now inside Settings tab) ───────────── */
.auto-updates-list {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.auto-updates-list[hidden] { display: none }
.au-group-label {
  /* Group labels were removed when we moved every channel to the
     pull-model — but rootpw-toggle (Server access tab) still nests an
     .au-row, and any future consumer might re-introduce a group. Keep
     the style; the markup just doesn't emit one anymore. */
  margin: .6rem 0 .15rem;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--muted2);
  padding-left: .1rem;
}
.au-group-label:first-child { margin-top: 0; }
.au-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .65rem .8rem;
  border-radius: 8px;
  border: 1px solid var(--border2);
  background: var(--surface-flat);
  cursor: pointer;
  transition: border-color .12s, background .12s;
}
.au-row:hover { border-color: var(--accent); background: var(--surface-flat-hover) }
/* `display: flex` above outranks the UA's `[hidden] { display: none }`, so a
   row JS hides (the Agent-extensions channel while the extensions switch is
   off) painted anyway until this companion rule existed (2026-08). */
.au-row[hidden] { display: none }
/* Update notices: a choice, not a switch — the row itself is not a click
   target, so it neither points nor lights up. */
.au-notices-row { margin-top: .5rem; cursor: default }
.au-notices-row:hover { border-color: var(--border2); background: var(--surface-flat) }
.au-notices-select { flex-shrink: 0; max-width: 45% }
/* overflow-wrap: on a phone the row's button and switch leave the text a
   narrow strip, and a long word (a Hermes commit SHA, a compound like
   "funktsiooniuuendused") would otherwise run out of the row. */
.au-text { flex: 1; display: flex; flex-direction: column; gap: .15rem; min-width: 0; overflow-wrap: anywhere }
.au-text strong { color: var(--text); font-weight: 600; font-size: .9rem }
.au-sub { color: var(--muted); font-size: .78rem; line-height: 1.35 }
.au-last {
  /* "Last updated 2 hours ago" — fainter, smaller, sits under the desc. */
  color: var(--muted2);
  font-size: .72rem;
  margin-top: .12rem;
  font-variant-numeric: tabular-nums;
}
.au-last[data-state="running"] { color: var(--accent) }
.au-last[data-state="error"] { color: var(--err) }
/* The title and its restart badge share one line; on a narrow row the
   badge wraps under the title instead of squeezing it. */
.au-head { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .5rem; min-width: 0 }
/* Which restart a channel's update can bring: the agent service alone (a
   few seconds) or the whole server (a new Linux kernel). A soft tinted pill
   without a border, so it reads as a note on the title rather than a second
   control; the title attribute carries the longer explanation. */
.au-restart {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
  padding: .08rem .5rem .08rem .42rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 13%, transparent);
  color: var(--muted);
  font-size: .68rem;
  font-weight: 500;
  line-height: 1.45;
  white-space: nowrap;
  cursor: help;
}
.au-restart::before {
  content: '';
  flex: 0 0 auto;
  width: .38rem;
  height: .38rem;
  border-radius: 50%;
  background: currentColor;
  opacity: .75;
}
.au-restart[data-restart="server"] {
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 14%, transparent);
}

/* Per-row "Update now" + top-level "Update all now". Same visual weight
   as outlined chip — flat fill that picks up --accent on hover so it
   reads as actionable without competing with the toggle for attention. */
.au-update-btn,
.au-update-all-btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
/* An update's run (settings.js data-state). Running keeps the spinner at full
   strength instead of the dimmed :disabled look; done and failed wear the
   system's done and error faces (base.css button[data-flash]). */
.au-update-btn[data-state="running"],
.au-update-all-btn[data-state="running"] { opacity: 1; cursor: progress }
.au-update-btn[data-state="ok"],
.au-update-all-btn[data-state="ok"] {
  opacity: 1;
  color: var(--success-status);
  border-color: color-mix(in srgb, var(--success-status) 50%, transparent);
}
.au-update-btn[data-state="error"],
.au-update-all-btn[data-state="error"] {
  background: var(--btn-danger-bg);
  color: var(--btn-danger-text);
  border-color: var(--btn-danger-border);
}

/* Inline state icons that sit beside the label inside the button. The
   .35rem gap from .au-update-btn handles spacing — no margin needed. */
.au-btn-spin {
  width: .85em;
  height: .85em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  display: inline-block;
  animation: au-btn-spin var(--beat) linear infinite;
  flex: 0 0 auto;
}
@keyframes au-btn-spin {
  to { transform: rotate(360deg); }
}
.au-btn-check {
  width: .95em;
  height: .95em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  animation: au-btn-pop 0.32s cubic-bezier(.34, 1.56, .64, 1) both;
}
.au-btn-check svg {
  width: 100%;
  height: 100%;
  display: block;
}
@keyframes au-btn-pop {
  0%   { transform: scale(0);    opacity: 0; }
  60%  { transform: scale(1.2); opacity: 1; }
  100% { transform: scale(1);    opacity: 1; }
}
.au-btn-label { display: inline-block; }

/* Header grid — intro+warn on the left, "Update all" on the right.
   Stacks on narrow widths so the button sits below the text. */
.au-header-grid {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin: 0 0 .55rem;
}
.au-header-text { flex: 1 1 auto; min-width: 0 }
.au-header-text .au-intro,
.au-header-text .au-warn { margin-bottom: 0 }
.au-header-text .au-intro { margin-bottom: .25rem }
.au-header-action {
  flex: 0 0 auto;
  padding-top: .1rem;
}
@media (max-width: 640px) {
  .au-header-grid { flex-direction: column; gap: .55rem }
  .au-header-action { align-self: flex-start }
  /* Each channel row stacks the same way: beside the button and the switch
     a phone left the text a ~100px strip, one word per line. The button
     drops under the text; the switch keeps its place on the first line.
     :not([hidden]) so this display can't outrank .au-row[hidden]. */
  .auto-updates-list > .au-row:not([hidden]) {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .55rem 1rem;
  }
  .auto-updates-list > .au-row > .au-toggle { grid-area: 1 / 2 }
  .auto-updates-list > .au-row > .au-update-btn { grid-area: 2 / 1; justify-self: start }
}

/* Master toggle + chevron sit together on the right side of the
   section header. Default panel-section-head is title + chevron with
   space-between; wrapping right-side items lets us avoid that gap
   collapsing the master switch toward the title. */
.panel-section-head-actions {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  flex-shrink: 0;
}
/* Stop the toggle from feeling like part of the channel rows below —
   it's a header-level "kill switch" so we keep it visually slightly
   smaller and the cursor stays a pointer on hover. */
.au-master-toggle { cursor: pointer; }

/* Toggle switch (pure CSS). */
.au-toggle {
  position: relative;
  display: inline-block;
  flex: 0 0 auto;
  width: 38px;
  height: 22px;
}
/* A switch a co-user may not move (extension_views.js switchOffReserved). */
.au-toggle[hidden] { display: none }
.au-toggle input[type="checkbox"] {
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.au-slider {
  position: absolute;
  inset: 0;
  /* Off state: a few shades lighter than the panel surface so the track
     reads as a distinct control, not a hole in the card. */
  background: var(--control-track-off);
  border: 1px solid var(--control-track-off-border);
  border-radius: 22px;
  transition: background .15s ease, border-color .15s ease;
}
.au-slider::before {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  top: 2px;
  left: 2px;
  background: var(--text);
  border-radius: 50%;
  transition: transform .15s ease;
  box-shadow: 0 1px 2px rgba(0,0,0,.45);
}
/* On state uses a dedicated filled-control palette: restrained mint on the
   dark canvas, airy indigo track with a dark indigo knob in light mode. */
.au-toggle input:checked ~ .au-slider {
  background: var(--accent-control);
  border-color: var(--accent-control-border);
}
.au-toggle input:checked ~ .au-slider::before {
  background: var(--accent-control-knob);
  transform: translateX(16px);
}
.au-toggle input:disabled ~ .au-slider { opacity: .5; cursor: not-allowed }
.au-status { margin: 0; font-size: .75rem }
.au-status.au-error { color: var(--err) }

/* Intro paragraph with the shared HH:00 picker inline in the sentence.
   Plain inline flow, not flex: the picker and zone label sit on the text
   baseline, and a narrow width wraps word by word, so the word before the
   picker never ends up alone on a line with the picker dropped below it. */
.au-intro {
  line-height: 1.45;
  margin-bottom: .25rem;
}
.au-warn {
  /* Sits tight under the intro — they read as one block, not two
     paragraphs. Negative top margin pulls the warning up flush against
     the time picker's baseline. */
  margin: -.05rem 0 .55rem;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.35;
}

/* Shared time picker — custom button + popover. We deliberately avoid the
   native <select> because the OS-styled option dropdown can't be themed
   to match the rest of the panel (every list the panel drops is one card,
   shell.css "Dropdowns"; native dropdowns are flat OS chrome). The popover itself is
   viewport-anchored (see .au-time-pop); the wrapper just keeps the trigger
   and its list one outside-click unit. */
.au-timepicker {
  display: inline-block;
  vertical-align: baseline;
  margin: 0 .45rem 0 .2rem;
}
.au-tz { color: var(--muted) }

/* The trigger, the list's surface and the tick are every dropdown's
   (shell.css "Dropdowns"); the hours keep tabular figures. */
.au-time-btn { font-variant-numeric: tabular-nums }
.au-time-btn-value { font-weight: 500 }

/* Anchored in the viewport by popover.js (top/left/max-height are set there),
   so the scrolling settings column can neither clip it nor paint over it.
   z-index clears the panel's own layers, stays under topbar (100)/modals. */
.au-time-pop {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 90;
  /* Room for an hour and its tick. */
  width: 7.5rem;
  max-height: 14rem;
  overflow-y: auto;
  /* Tabular numbers so the column stays clean. */
  font-variant-numeric: tabular-nums;
}
.au-time-pop[hidden] { display: none }
.au-time-pop::-webkit-scrollbar { width: 6px }
.au-time-pop::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px }
.au-time-pop::-webkit-scrollbar-thumb:hover { background: var(--muted) }

.au-time-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  width: 100%;
  padding: .42rem .6rem;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: .85rem;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  text-align: left;
  cursor: pointer;
  box-shadow: none;
}
.au-time-opt:hover,
.au-time-opt:focus-visible {
  background: var(--shell-hover);
  border: 0;
  color: var(--text);
  outline: none;
}
.au-time-opt:active { transform: none }
.au-time-opt[aria-selected="true"] { font-weight: 600 }

/* ── Persona overlay — user-editable text appended to SOUL.md ──── */

.persona-textarea {
  width: 100%;
  min-height: 12rem;
  padding: .75rem .85rem;
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: var(--mono);
  font-size: .85rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.persona-textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 12%, transparent);
}
.persona-textarea:disabled { opacity: .55; cursor: progress }

.persona-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  margin-top: .65rem;
  font-size: .8rem;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.persona-actions #personaSave {
  margin-left: auto;
  min-width: 6.5rem;
}
.persona-counter { color: var(--text); font-weight: 500 }
.persona-counter-sep { color: var(--muted2) }
.persona-counter.over { color: var(--persona-danger) }
.persona-status { margin-top: .55rem }
.persona-status.persona-error { color: var(--persona-danger) }
.persona-status.persona-ok { color: var(--accent) }

/* ── Server access — SSH key list ──────────────────────────────── */

/* One vertical rhythm for the unified SSH section. Headers own their
   actions; credentials and the connection guide have room to breathe. */
.ssh-access-body { gap: 1.5rem; }
.ssh-access-block { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
.ssh-keys-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1.5rem; }
.ssh-block-heading { display: flex; flex-direction: column; gap: .45rem; min-width: 0; }
.ssh-access-block h4 { margin: 0; font-size: .9rem; font-weight: 650; line-height: 1.4; }
.ssh-block-heading .section-intro { max-width: 62ch; }
.ssh-keys-header .ssh-add-trigger { margin: 0; flex-shrink: 0; padding-top: .1rem; }
.ssh-keys-header .ssh-add-open { white-space: nowrap; }
.ssh-access-block .ssh-list { gap: .75rem; }
.ssh-access-block .ssh-row { padding: .95rem 1rem; gap: 1rem; border-radius: 10px; }
.ssh-access-block .ssh-row .ssh-meta { gap: .5rem; }
.ssh-access-block .ssh-row .ssh-line { align-items: center; gap: .45rem .6rem; line-height: 1.5; }
.ssh-access-block .ssh-fp { line-height: 1.5; }
.ssh-connection-panel { padding: 1rem 1.1rem; border: 1px solid var(--outline-subtle); border-radius: 12px; background: var(--surface-subtle); gap: .65rem; }
.ssh-connection-panel > .hint { margin: 0; line-height: 1.6; }

/* Put the instruction above its command, aligned with the rest of the card. */
.ssh-info-row { display: flex; flex-direction: column; align-items: stretch; gap: .8rem; margin: 0; min-width: 0; }
.ssh-info-row .ssh-info-text { margin: 0; text-align: left; line-height: 1.6; }
.ssh-info-row .ssh-cmd-copy { min-width: 0; margin: 0; padding: .85rem 1rem; border-radius: 9px; }
.ssh-access-block[hidden], .ssh-info-row[hidden], .sshd-progress[hidden] { display: none; }

@media (max-width: 600px) {
  .ssh-keys-header { flex-direction: column; gap: .85rem; }
  .ssh-access-block .ssh-row { align-items: flex-start; flex-wrap: wrap; padding: .85rem; }
  .ssh-access-block .ssh-row .ssh-meta { flex-basis: 100%; }
  .ssh-access-block .ssh-row .ssh-protected-tag { flex-shrink: 1; overflow-wrap: anywhere; }
  .ssh-access-block .ssh-del { margin-left: auto; }
}

/* Click-to-copy `ssh root@…` command shown above the add-key form.
   It's a <button> (so keyboard / a11y work the same as any other
   action) but styled like an inline terminal block. */
.ssh-cmd-copy {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  margin: 0 0 .55rem;
  padding: .6rem .85rem;
  background: var(--bg3);
  border: 1px solid var(--border2);
  border-radius: 8px;
  font-family: var(--mono);
  font-size: .85rem;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.ssh-cmd-copy:hover {
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  border-color: color-mix(in srgb, var(--accent) 42%, transparent);
  color: var(--text);
}
.ssh-cmd-copy.copied {
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
}
.ssh-cmd-copy .ssh-cmd-prompt {
  color: var(--accent);
  font-weight: 600;
  user-select: none;
  flex-shrink: 0;
}
.ssh-cmd-copy code {
  flex: 1;
  min-width: 0;
  background: transparent;
  padding: 0;
  font-size: .85rem;
  color: var(--text);
  word-break: break-all;
}
.ssh-cmd-copy .ssh-cmd-status {
  flex-shrink: 0;
  font-family: var(--font);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
}
.ssh-cmd-copy.copied .ssh-cmd-status { color: var(--accent) }

/* "+ Add SSH key" trigger row — visually quiet so the list stays the
   focus, but clearly tappable. */
.ssh-add-trigger {
  display: flex;
  justify-content: flex-start;
  margin: .15rem 0 .15rem;
}

/* The form itself — boxed card so it stands clearly apart from the
   list above it when expanded. */
.ssh-add {
  display: flex;
  flex-direction: column;
  gap: .65rem;
  margin-top: .25rem;
  padding: .9rem 1rem 1rem;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 4%, transparent);
}
/* `display: flex` above outranks the UA's `[hidden] { display: none }`,
   so the form would render even when the `hidden` attribute is set.
   Restore the intended hide behaviour explicitly. */
.ssh-add[hidden] { display: none; }
.ssh-add-heading {
  margin: 0 0 .1rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .01em;
}
.ssh-add textarea {
  font-family: var(--mono);
  font-size: .78rem;
  line-height: 1.4;
  white-space: pre;
  word-break: break-all;
  resize: none;
}
.ssh-add-actions {
  display: flex;
  justify-content: flex-end;
  gap: .55rem;
  margin-top: .15rem;
}
.ssh-error { color: var(--err); margin: 0 }

.ssh-list {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}
.ssh-list .empty { color: var(--muted); font-size: .82rem; margin: 0 }

.ssh-row {
  display: flex;
  align-items: center;
  gap: .85rem;
  padding: .65rem .8rem;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--surface-subtle);
}
.ssh-row .ssh-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: .2rem }
.ssh-row .ssh-line { display: flex; flex-wrap: wrap; gap: .45rem; align-items: baseline; font-size: .82rem }
.ssh-row .ssh-type {
  font-family: var(--mono);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-softer);
  border: 1px solid color-mix(in srgb, var(--accent) 25%, transparent);
  padding: .08rem .45rem;
  border-radius: 4px;
  flex-shrink: 0;
}
.ssh-row .ssh-comment {
  color: var(--text);
  font-weight: 500;
  overflow-wrap: anywhere;
}
.ssh-row .ssh-fp {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  word-break: break-all;
}
.ssh-row .ssh-protected-tag {
  font-size: .68rem;
  letter-spacing: .02em;
  color: var(--warn);
  background: color-mix(in srgb, var(--warn) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent);
  padding: .08rem .45rem;
  border-radius: 4px;
  font-weight: 600;
  flex-shrink: 0;
}
.ssh-row button.ssh-del {
  flex-shrink: 0;
}
.ssh-row.invalid { border-style: dashed; opacity: .9 }
.ssh-row.invalid .ssh-comment { color: var(--warn) }

/* ── Server access — Root password ─────────────────────────────── */
.rootpw-card {
  display: flex;
  flex-direction: column;
  gap: .8rem;
  padding: .9rem 1rem;
  border: 1px solid var(--outline-subtle);
  border-radius: 10px;
  background: var(--surface-subtle);
}
.rootpw-display {
  display: flex;
  align-items: center;
  gap: .55rem;
  font-family: var(--mono);
  font-size: 1.1rem;
  font-weight: 600;
  letter-spacing: .04em;
  padding: .8rem 1rem;
  border-radius: 9px;
  background: var(--bg3);
  border: 1px solid var(--border2);
  color: var(--text);
  word-break: break-all;
}
.rootpw-display.empty {
  font-family: inherit;
  font-size: .85rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0;
  font-style: italic;
}
.rootpw-copy {
  flex-shrink: 0;
}
.rootpw-value-clickable {
  cursor: pointer;
  border-radius: 4px;
  transition: color .12s ease, background-color .12s ease;
}
.rootpw-value-clickable:hover { color: var(--accent) }
.rootpw-value-clickable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.rootpw-meta { font-size: .75rem; color: var(--muted) }
.rootpw-field {
  display: flex;
  flex-direction: column;
  gap: .35rem;
}
.rootpw-label {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--muted);
}
.rootpw-display-row {
  display: flex;
  align-items: stretch;
  gap: .55rem;
  flex-wrap: wrap;
}
.rootpw-display-row .rootpw-display {
  flex: 1 1 calc(50% - .275rem);
  min-width: 14rem;
  margin: 0;
}
.rootpw-display-row .rootpw-rotate {
  flex: 1 1 calc(50% - .275rem);
  min-width: 12rem;
}

/* SSH password-login toggle. The "--top" variant is the master switch
   at the head of the Root password subview; the password block below
   only renders when this toggle is on. */
.rootpw-toggle {
  display: flex;
  flex-direction: column;
  gap: .55rem;
}
.rootpw-toggle--top {
  margin: 0;
  padding: 0;
  border-top: none;
}
.rootpw-toggle .au-row { cursor: pointer }
/* Each SSH setting owns its outline; neither switch is a nested card. */
.sshd-password-card { margin-top: .8rem }
.sshd-card .au-row,
.sshd-password-card .au-row {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}
.rootpw-toggle .hint { margin: 0; font-size: .76rem; line-height: 1.4 }
/* A computer's SSH switch while on: the password-login warning (.sec-warn,
   security.css) under the switch, at the sub-text's size; the column's gap
   spaces it. The confirmation shows the same sentence at .sec-warn's own. */
.sshd-card .sshd-password-warning { margin: 0; font-size: .78rem; line-height: 1.4 }

/* While the machine works on the SSH switch (or a key change on a computer,
   where root does it): a small ring turning beside one plain sentence that
   breathes. No raw states, ids or codes -- those stay in the console. The
   same line carries the "check request" sentence and button when the
   computer has still not picked up a request after a minute. */
.sshd-progress {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .55rem;
  margin: .65rem 0 0;
  line-height: 1.5;
}
.sshd-progress-spin {
  width: .95em;
  height: .95em;
  flex: 0 0 auto;
  border: 2px solid var(--border2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: sshd-progress-spin var(--beat) linear infinite;
}
.sshd-progress-label { animation: sshd-progress-breathe var(--beat) ease-in-out infinite; }
.sshd-progress .btn-secondary { margin: 0; }
@keyframes sshd-progress-spin { to { transform: rotate(360deg); } }
@keyframes sshd-progress-breathe { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) {
  .sshd-progress-spin { animation-duration: calc(var(--beat) * 2); }
  .sshd-progress-label { animation: none; }
}

/* A compact, keyboard-native disclosure, not the generic details top rule.
   Keep the password UI inside one surface instead of nesting bordered cards. */
details.ssh-password-panel:not(.panel-section) {
  margin: 0;
  padding: 0;
  border: 1px solid var(--outline-subtle);
  border-radius: 12px;
  background: var(--surface-subtle);
  min-width: 0;
}
details.ssh-password-panel[hidden] { display: none; }
details.ssh-password-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  margin: 0;
  list-style: none;
  color: var(--text);
  font-size: .9rem;
  font-weight: 650;
  border-radius: 12px;
}
details.ssh-password-panel > summary::before { content: none; }
details.ssh-password-panel[open] > summary { margin-bottom: 0; }
details.ssh-password-panel > summary:hover { background: var(--surface-hover); }
details.ssh-password-panel > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ssh-password-chevron { flex-shrink: 0; color: var(--muted); transition: transform .15s ease; }
.ssh-password-panel[open] .ssh-password-chevron { transform: rotate(90deg); }
.ssh-password-body { display: flex; flex-direction: column; gap: 1rem; padding: 0 1.1rem 1.1rem; }
.ssh-password-body .rootpw-card { padding: 0; border: 0; background: transparent; gap: 1rem; }
.ssh-password-body .au-row { padding: 0; border: 0; background: transparent; }
.ssh-password-body .rootpw-display { flex: 1 1 14rem; min-width: 0; flex-wrap: wrap; }
.ssh-password-body .rootpw-rotate { flex: 0 1 auto; min-width: 0; }
.ssh-password-body .rootpw-value-clickable { min-width: 0; overflow-wrap: anywhere; }

/* ── Server access — Terminal ───────────────────────────────────── */
.terminal-controls {
  display: flex;
  align-items: center;
  gap: .65rem;
  flex-wrap: wrap;
}
.terminal-status {
  font-size: .78rem;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}
.terminal-status::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--muted2);
}
/* Connected: a lamp in LED green and the word in green (feedback #16). */
.terminal-status.connected { color: var(--success-status) }
.terminal-status.connected::before { background: var(--led-on) }
.terminal-status.error { color: var(--err) }
.terminal-status.error::before { background: var(--led-err) }

.terminal-frame {
  border: 1px solid var(--border2);
  border-radius: 10px;
  background: #000;
  overflow: hidden;
  /* Fits comfortably in the panel; xterm fills 100% of inner area. */
  height: clamp(280px, 50vh, 540px);
  position: relative;
}
/* Shown on its own (the sidebar's Terminal shortcut, the agent's open_panel
   tool) the terminal is the whole dialog: the frame takes every row under
   the controls instead of stopping at its fixed height with a bare strip
   below. shell.css passes the dialog's height down to the card; xterm's
   fit addon follows the frame through its ResizeObserver. */
.settings-view[data-focus="terminal"] .terminal-frame {
  flex: 1 1 auto;
  height: auto;
  min-height: 200px;
}
.terminal-canvas {
  width: 100%;
  height: 100%;
  padding: .35rem;
  box-sizing: border-box;
}
.terminal-canvas .xterm,
.terminal-canvas .xterm-viewport,
.terminal-canvas .xterm-screen {
  width: 100% !important;
  height: 100% !important;
}

/* The shell's own light background (server_access.js keeps the choice in
   this browser, apart from the panel's theme): the frame goes white, and
   xterm's colours follow from the module. */
.terminal-frame[data-terminal-theme="light"] { background: #fff }

/* The frame's corner buttons — sun/moon and fullscreen, small overlays in
   the top-right. They stay visible at low opacity and brighten on hover. */
.terminal-corner-btn {
  position: absolute;
  top: 6px;
  z-index: 2;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 6px;
  border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
  background: rgba(0,0,0,.55);
  color: #d8dde2;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: .55;
  transition: opacity .15s, background .15s, border-color .15s, color .15s;
}
.terminal-corner-btn:hover {
  opacity: 1;
  background: rgba(0,0,0,.78);
  border-color: var(--accent);
  color: var(--accent);
}
.terminal-corner-btn.on { color: var(--accent); border-color: var(--accent); opacity: .9 }
.terminal-frame[data-terminal-theme="light"] .terminal-corner-btn {
  background: rgba(255,255,255,.7);
  color: #4b5563;
}
.terminal-frame[data-terminal-theme="light"] .terminal-corner-btn:hover {
  background: rgba(255,255,255,.95);
  color: var(--accent);
}
.terminal-fs-btn { right: 6px }
.terminal-theme-btn { right: 40px }
.terminal-ico { width: 15px; height: 15px }
/* The sun on a dark shell, the moon on a light one: what a click gives. */
.terminal-theme-btn .ico-moon { display: none }
.terminal-frame[data-terminal-theme="light"] .terminal-theme-btn .ico-sun { display: none }
.terminal-frame[data-terminal-theme="light"] .terminal-theme-btn .ico-moon { display: inline }

/* When the frame itself is the fullscreen element, fill the viewport
   and let xterm expand to use it. */
.terminal-frame:fullscreen {
  width: 100vw;
  height: 100vh;
  border-radius: 0;
  border: none;
}
.terminal-frame:fullscreen .terminal-canvas { padding: .5rem }

/* ── Projects (Settings → Projects, projects.js) ───────────────── */
/* The list: one bordered column with a hairline between rows (the shape of
   the LLM-provider list). The selected row — where new chats start — is
   tinted and wears its badge; a row's menu button shows on hover, and always
   where there is no hover to speak of. */
.prj-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--outline-subtle);
  border-radius: 12px;
  overflow: hidden;
}
.prj-list:empty { display: none }
.prj-list > .hint { margin: 0; padding: .8rem 1rem }
.prj-row {
  display: flex;
  align-items: center;
  gap: .8rem;
  min-height: 3.3rem;
  padding: .55rem .6rem .55rem .85rem;
  border-top: 1px solid var(--outline-subtle);
  background: var(--surface-subtle);
  transition: background .15s;
}
.prj-row:first-child { border-top: 0 }
.prj-row:hover { background: var(--surface-hover) }
.prj-row.is-selected { background: color-mix(in srgb, var(--accent) 6%, var(--surface-subtle)) }
.prj-row.is-unavailable .prj-text { opacity: .6 }
.prj-icon {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 9px;
  background: var(--surface-hover);
  color: var(--muted);
}
.prj-icon svg { width: 17px; height: 17px }
.prj-row.is-selected .prj-icon { background: var(--accent-soft); color: var(--accent) }
.prj-text { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: .12rem }
.prj-head { display: flex; align-items: center; gap: .45rem; min-width: 0 }
.prj-name {
  min-width: 0;
  font-size: .92rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Who sees it. On a one-user agent private is the only kind there is, so
   its tag shows under body[data-shared-agent] alone (member_view.js). */
.prj-tag {
  flex: none;
  max-width: 12rem;
  padding: .06rem .45rem;
  border: 1px solid var(--border2);
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 600;
  color: var(--muted2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.prj-tag--private { display: none }
body[data-shared-agent] .prj-tag--private { display: inline-block }
.prj-meta { font-size: .76rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.prj-meta .is-warn { color: var(--warn) }
.prj-selected {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: 0 .6rem 0 .45rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: .7rem;
  font-weight: 600;
  line-height: 1.5rem;
  white-space: nowrap;
}
.prj-selected svg { width: 12px; height: 12px; flex: none }
.prj-more { flex: none; opacity: 0; transition: opacity .15s }
.prj-row:hover .prj-more,
.prj-row:focus-within .prj-more,
.prj-more[aria-expanded="true"] { opacity: 1 }
@media (hover: none) { .prj-more { opacity: 1 } }
@media (max-width: 480px) {
  /* The badge keeps its check mark; the words go to the tooltip. */
  .prj-selected { padding: 0 .4rem }
  .prj-selected-text { display: none }
}
.prj-rename-input {
  width: 100%;
  max-width: 22rem;
  margin: 0;
  padding: .15rem .4rem;
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
}

/* Creating: a dashed "+ New project" line stands where the form will be;
   the form takes its place when asked for (the invite flow's shape). A small
   gap under the list keeps it from reading as the list's last row. */
.prj-list:not(:empty) + .prj-create { margin-top: .6rem }
.prj-create-open {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  width: 100%;
  min-height: var(--btn-h);
  padding: .55rem .8rem;
  font: inherit;
  font-size: var(--btn-fs);
  font-weight: 600;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--border2);
  border-radius: 10px;
  box-shadow: none;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.prj-create-open:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-softer) }
.prj-create-open[hidden] { display: none }
.prj-create-plus { font-size: 1.15rem; line-height: 1 }
.prj-create-pane {
  display: flex;
  flex-direction: column;
  gap: .55rem;
  padding: .9rem 1rem 1rem;
  background: var(--surface-row);
  border: 1px solid var(--border2);
  border-left: 2px solid var(--accent);
  border-radius: 10px;
  animation: byok-form-fade .18s ease-out;
}
.prj-create-pane[hidden] { display: none }
.prj-field-label {
  display: block;
  margin: 0;
  padding: 0;
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--muted);
}
.prj-create-input { margin: 0 }
.prj-visibility {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  min-width: 0;
  margin: .25rem 0 0;
  padding: 0;
  border: 0;
}
/* Who sees it is a question only where somebody else could: an agent with
   other users (member_view.js sets body[data-shared-agent]). The quick-create
   dialog leaves the fieldset out altogether (projects.js openCreate). */
.prj-create-pane .prj-visibility { display: none }
body[data-shared-agent] .prj-create-pane .prj-visibility { display: flex }
/* In the quick-create dialog: as far from the name as the name's label is
   from the dialog head. */
.modal-body .prj-visibility { margin-top: .9rem }
.prj-vis-options { display: flex; flex-direction: column; gap: .1rem }
/* One plain radio line per option, one under the other: no card, no frame.
   The radio itself is read by the keyboard and the screen reader only, the
   dot shows what it holds. Scoped to the fieldset so the quick-create
   dialog's form-label look (modal.css `.modal-body label`: uppercase,
   block) stays off the lines. */
.prj-visibility .prj-vis-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: .6rem;
  margin: 0;
  padding: .35rem 0;
  font-size: .88rem;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text);
  background: none;
  border: 0;
  cursor: pointer;
}
.prj-vis-option input { position: absolute; width: 1px; height: 1px; margin: 0; opacity: 0; pointer-events: none }
.prj-vis-mark {
  position: relative;
  flex: none;
  width: 16px;
  height: 16px;
  border: 1.5px solid var(--muted2);
  border-radius: 50%;
  transition: border-color .12s;
}
.prj-vis-option:hover .prj-vis-mark { border-color: var(--outline-hover) }
.prj-vis-option:has(input:checked) .prj-vis-mark { border-color: var(--accent) }
.prj-vis-option:has(input:checked) .prj-vis-mark::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--accent);
}
.prj-vis-option:has(input:focus-visible) .prj-vis-mark { outline: 2px solid var(--focus-outline); outline-offset: 2px }
.prj-create-actions { display: flex; justify-content: flex-end; gap: .5rem; margin-top: .25rem }

/* Removed: a quiet disclosure line under the list, its rows a shade
   fainter than the live ones. */
.prj-removed[hidden] { display: none }
.prj-removed-toggle {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .15rem 0;
  font: inherit;
  font-size: .8rem;
  color: var(--muted);
  background: none;
  border: 0;
  box-shadow: none;
  cursor: pointer;
}
.prj-removed-toggle:hover { color: var(--text); background: none }
.prj-removed-toggle::before {
  content: '';
  display: inline-block;
  flex: none;
  width: .75rem;
  height: .75rem;
  background: currentColor;
  -webkit-mask: var(--caret-right) center / contain no-repeat;
  mask: var(--caret-right) center / contain no-repeat;
  transition: transform .15s;
}
.prj-removed-toggle[aria-expanded="true"]::before { transform: rotate(90deg) }
.prj-removed-body { display: flex; flex-direction: column; gap: .6rem; margin-top: .5rem }
.prj-removed-body[hidden] { display: none }
.prj-removed-body > .hint { margin: 0 }
.prj-list--removed .prj-row { background: transparent }
.prj-list--removed .prj-name { color: var(--muted); font-weight: 500 }
.prj-list--removed .prj-icon { background: transparent; border: 1px dashed var(--border2) }

/* The instructions editor and the permanent-delete dialog (modals). */
.prj-instructions-body .mb-hint { margin-top: 0 }
.prj-folder { display: flex; flex-wrap: wrap; align-items: baseline; gap: .2rem .5rem; margin: 0 0 .6rem; font-size: .76rem; color: var(--muted) }
.prj-folder code { font-family: var(--mono); font-size: .74rem; color: var(--text); overflow-wrap: anywhere }
.prj-instructions {
  width: 100%;
  min-height: 15rem;
  resize: vertical;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.5;
}
.prj-purge-input { font-family: var(--mono) }

/* ── Server performance (server_perf.js) ─────────────────────────────── */

.perf-controls { width: fit-content; max-width: 100%; align-self: flex-start; margin: 0 0 0.8rem; }
/* Two columns: four charts make a square, and each is wide enough that its
   axis labels stay legible; one column on a narrow screen. */
.perf-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.9rem; transition: opacity 0.15s; }
@media (max-width: 720px) { .perf-grid { grid-template-columns: minmax(0, 1fr); } }
.perf-grid.is-refetching { opacity: 0.55; }
.perf-chart {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 0.85rem 1rem 0.85rem;
  background: var(--security-row-bg, var(--surface-row));
  min-width: 0;
  transition: border-color 0.15s, box-shadow 0.15s;
}
/* The cards beside each other share one head row, one plot row and one
   button row (subgrid), so the plots and the buttons under them stand on
   one line whatever a head holds; without subgrid the button at least
   keeps to the card's bottom edge. */
.perf-chart > .perf-chart-foot { margin-top: auto; }
@supports (grid-template-rows: subgrid) {
  /* minmax(0, 1fr): an implicit auto column grows to the button's text
     and pushes it and the head's tools past the card's edge. */
  .perf-chart {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: subgrid;
    grid-row: span 3;
    row-gap: 0.55rem;
    align-content: start;
  }
  .perf-chart > .perf-chart-foot { margin-top: 0; align-self: end; }
}
.perf-chart:hover { border-color: var(--border2); box-shadow: 0 8px 24px -18px rgba(0, 0, 0, 0.45); }
.perf-chart-head { display: flex; flex-direction: column; gap: 0.35rem; }
.perf-chart-top { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; min-height: 28px; }
.perf-chart-title { margin: 0; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
/* The expand button and, beside it, the chart's pin (sidebar_pins.js lands
   it right after the button). Both are the panel's icon buttons; the expand
   stays in view, the pin shows as the chart or the pin is pointed at. */
.perf-chart-tools { display: flex; align-items: center; gap: 0.1rem; margin: -2px -6px -2px 0; }
.perf-chart-tools .shell-icon-btn { width: 28px; height: 28px; }
.perf-chart-tools .perf-expand { color: var(--muted); }
.perf-chart-tools .perf-expand:hover { color: var(--text); background: var(--surface-control); }
.perf-chart-tools .settings-pin { margin-left: 0; }
.perf-now { display: flex; flex-wrap: wrap; gap: 0.3rem 1.4rem; }
.perf-stat { display: flex; flex-direction: column; gap: 0.05rem; min-width: 0; }
.perf-stat + .perf-stat { padding-left: 1.4rem; border-left: 1px solid var(--border); margin-left: -0.1rem; }
.perf-now-value { font-size: 1.45rem; font-weight: 650; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--text); }
/* Memory and disk: the GB large, the percent of the machine beside it in a
   quiet pill, on the number's line while there is room. */
.perf-now-main { display: flex; flex-wrap: wrap; align-items: center; gap: 0.2rem 0.55rem; min-width: 0; }
.perf-now-pct {
  padding: 0.1rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface-control);
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
}
.perf-large-chart .perf-now-pct { font-size: 0.92rem; }
.perf-now-sub { font-size: 0.76rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Two series side by side on a card: smaller figures, so they share a row;
   too narrow for that, the second goes under the first. */
.perf-now--multi { flex-wrap: wrap; gap: 0.3rem 0.9rem; }
.perf-chart .perf-now--multi .perf-now-value { font-size: 1.15rem; }
.perf-chart .perf-now--multi .perf-now-sub { font-size: 0.72rem; }
/* No divider on a card: the second stat may have gone under the first. */
.perf-chart .perf-now--multi .perf-stat + .perf-stat { padding-left: 0; border-left: 0; margin-left: 0; }
/* The two lines' names, over the plot's top right corner. */
.perf-legend {
  position: absolute;
  top: 0;
  right: 0;
  display: flex;
  gap: 0.8rem;
  margin: 0;
  padding: 0.1rem 0.2rem 0.1rem 0.4rem;
  list-style: none;
  font-size: 0.76rem;
  color: var(--muted);
  background: var(--security-row-bg, var(--surface-row));
  border-radius: 4px;
  pointer-events: none;
}
.perf-legend li { display: inline-flex; align-items: center; gap: 0.35rem; }
.perf-key { display: inline-block; width: 14px; height: 0; border-top: 2px solid currentColor; border-radius: 2px; }
.perf-key.perf-s1 { color: var(--chart-1); }
.perf-key.perf-s2 { color: var(--chart-2); }
/* The plot is drawn at the host's measured width (server_perf.js), so the
   axis text below is real CSS pixels at every screen width. */
.perf-plot-host { min-width: 0; }
.perf-plot { position: relative; }
.perf-svg { display: block; width: 100%; height: auto; overflow: visible; }
line.perf-grid { stroke: var(--border); stroke-width: 1; stroke-dasharray: 2 4; opacity: 0.8; }
line.perf-grid.perf-base { stroke-dasharray: none; opacity: 1; }
.perf-axis { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.perf-line { stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.perf-line.perf-s1 { stroke: var(--chart-1); }
.perf-line.perf-s2 { stroke: var(--chart-2); }
.perf-fill { stroke: none; }
.perf-stop-top { stop-opacity: 0.28; }
.perf-stop-bottom { stop-opacity: 0; }
.perf-stop-top.perf-s1, .perf-stop-bottom.perf-s1 { stop-color: var(--chart-1); }
.perf-stop-top.perf-s2, .perf-stop-bottom.perf-s2 { stop-color: var(--chart-2); }
.perf-end, .perf-mark { stroke: var(--card); stroke-width: 2; pointer-events: none; }
.perf-end.perf-s1, .perf-mark.perf-s1 { fill: var(--chart-1); }
.perf-end.perf-s2, .perf-mark.perf-s2 { fill: var(--chart-2); }
.perf-cross { stroke: var(--muted2); stroke-width: 1; stroke-dasharray: 3 3; pointer-events: none; }
.perf-hit { cursor: crosshair; outline: none; }
.perf-hit:focus-visible { outline: 2px solid var(--accent); }
.perf-tip {
  position: absolute;
  top: 0;
  transform: translateX(-50%);
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  background: var(--card);
  border: 1px solid var(--border2);
  box-shadow: 0 6px 20px -10px rgba(0, 0, 0, 0.5);
  font-size: 0.82rem;
  pointer-events: none;
  white-space: nowrap;
  z-index: 2;
}
.perf-tip[hidden] { display: none; }
.perf-tip[data-side="left"] { transform: translateX(calc(-100% - 10px)); }
.perf-tip[data-side="right"] { transform: translateX(10px); }
.perf-tip-when { color: var(--muted); margin-bottom: 0.2rem; }
.perf-tip-row { display: flex; align-items: center; gap: 0.4rem; }
.perf-tip-name { color: var(--muted); }
/* Under each chart, the way to a chat about that resource; under the grid,
   the one about the server's load as a whole. */
.perf-chart-foot { display: flex; min-width: 0; margin-top: 0.1rem; }
.perf-optimize, .perf-discuss {
  max-width: 100%;
}
.perf-optimize svg, .perf-discuss svg { flex: 0 0 auto; }
.perf-optimize span, .perf-discuss span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A card's button wraps rather than cuts its words on a narrow card. */
.perf-optimize { text-align: left }
.perf-optimize span { white-space: normal; overflow-wrap: anywhere; }
.perf-foot { display: flex; justify-content: flex-start; margin-top: 0.9rem; }

/* One chart, larger, in its own dialog (openPerfChart). */
.modal-card.modal-card--perf { width: min(1040px, calc(100vw - 2rem)); max-width: none; }
.perf-large-chart { display: flex; flex-direction: column; gap: 0.7rem; transition: opacity 0.15s; }
.perf-large-chart.is-refetching { opacity: 0.55; }
.perf-large-chart .perf-chart-title { display: none; }
.perf-large-chart .perf-now-value { font-size: 1.9rem; }
.perf-large-chart .perf-legend { background: var(--bg2); font-size: 0.82rem; }
.perf-large-chart .perf-now--multi .perf-now-value { font-size: 1.5rem; }
.perf-large-chart .perf-axis { font-size: 13px; }

/* Resource warnings (resource_watchdog.js): a status and, for an active
   warning, a localized action that drafts a request to the agent. */
.rwd-heading {
  margin: 1.1rem 0 0.45rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.rwd-heading:has(+ .rwd-list:empty) { display: none; }
.rwd-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.4rem; }
.rwd-list:empty { display: none; }
.rwd-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border2);
  border-radius: 10px;
  background: var(--bg2);
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
}
/* The panel's one status mark: a flat 7 px dot in a palette status colour. */
.rwd-dot { flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%; background: var(--success-status); }
.rwd-text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.rwd-level { flex: 0 0 auto; font-size: 0.76rem; color: var(--muted); }
.rwd-fix {
  flex: 0 1 auto;
  max-width: 100%;
  margin-left: auto;
  white-space: normal;
  overflow-wrap: anywhere;
}
.rwd-item--warn .rwd-dot { background: var(--warn); }
.rwd-item--warn .rwd-level { color: var(--warn); font-weight: 600; }
.rwd-item--crit { border-color: color-mix(in srgb, var(--err) 45%, var(--border2)); }
.rwd-item--crit .rwd-dot { background: var(--err); }
.rwd-item--crit .rwd-level { color: var(--err); font-weight: 600; }

/* ── E-mail (Settings → E-mail, mailbox.js) ─────────────────────── */
/* The address on its own line, then the mailbox: a toolbar (folders, search,
   check) over one bordered column of messages, the shape of the project
   list. A message opens in place, under its own row. */
/* E-mail switched off for the agent (mail_settings.js, mail_unread.js set
   body[data-mail-off]): of the whole category only the switch is left. */
/* The body keeps the rhythm of the section it sits in (.panel-section-body):
   the address stands as far from the switch above as from the words below,
   and the two paragraphs stand apart. */
.mail-enabled-body { display: flex; flex-direction: column; gap: .9rem }
.mail-enabled-body[hidden] { display: none }
body[data-mail-off] .panel-section[data-section^="email-"]:not([data-section="email-address"]) { display: none }
.mail-address-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap }
.mail-address-row[hidden] { display: none }
.mail-address {
  padding: .35rem .6rem;
  border: 1px solid var(--outline-subtle);
  border-radius: 8px;
  background: var(--surface-subtle);
  font-size: .92rem;
  color: var(--text);
  user-select: all;
  overflow-wrap: anywhere;
}
/* An address is its own copy button: a click copies it and says so in its
   place for a moment (mailbox.js, copyOnClick). */
.mail-address-copy {
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-weight: 400;
  line-height: inherit;
  text-align: center;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, background .15s;
}
.mail-address-copy:hover { border-color: var(--accent); background: var(--surface-flat-hover) }
.mail-address-copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px }
.mail-address-copy.is-copied { color: var(--accent) }
/* An address inside a sentence (the intro's example of a project's address):
   the same button at the size of the words around it. */
.mail-example-address {
  display: inline-block;
  box-sizing: border-box;
  max-width: 100%;
  margin: 0 .1rem;
  padding: .02rem .4rem;
  border-radius: 6px;
  font-size: .78rem;
  vertical-align: baseline;
}
.mail-action {
  flex: none;
}
.mail-action[hidden] { display: none }
.mail-action--primary { border-color: var(--accent); color: var(--accent); font-weight: 600 }
.mail-toolbar { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .7rem }
/* The toolbar's two buttons, each with its sign: checking for mail (the
   arrow turns while the agent looks) and, filled, a new message. */
button.mail-tool {
  flex: none;
  transform: none;
}
button.mail-tool:active { transform: none }
button.mail-tool:disabled { opacity: .75 }
.mail-tool-icon { flex: none; width: 16px; height: 16px }
button.mail-tool.is-busy .mail-tool-icon { animation: mail-tool-turn var(--beat) linear infinite }
@keyframes mail-tool-turn { to { transform: rotate(360deg) } }
@media (prefers-reduced-motion: reduce) {
  button.mail-tool.is-busy .mail-tool-icon { animation: none }
}
.mail-folder-pin { flex: none; width: 13px; height: 13px }
/* The folders are one segmented control (.seg, base.css). */
.mail-folders { flex: none }
button.mail-folder:active { transform: none }
.mail-folder-count {
  min-width: 1.15rem;
  padding: 0 .3rem;
  border-radius: 999px;
  background: var(--accent);
  color: var(--bg);
  font-size: .66rem;
  font-weight: 700;
  line-height: 1.15rem;
  text-align: center;
}
.mail-folder-count[hidden] { display: none }
/* Junk and sent copies waiting unread ask for no attention: their counts are grey. */
.mail-folder[data-folder="sent"] .mail-folder-count,
.mail-folder[data-folder="junk"] .mail-folder-count {
  background: var(--surface-control);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--border2);
  font-weight: 600;
}
.mail-search {
  flex: 1 1 12rem;
  min-width: 0;
  padding: .34rem .6rem;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-size: .84rem;
  color: var(--text);
}
.mail-list {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--outline-subtle);
  border-radius: 12px;
  overflow: hidden;
}
.mail-list > .mail-empty { margin: 0; padding: .8rem 1rem }
.mail-item { border-top: 1px solid var(--outline-subtle); background: var(--surface-subtle) }
.mail-item:first-child { border-top: 0 }
.mail-row {
  display: flex;
  flex-direction: column;
  gap: .12rem;
  width: 100%;
  padding: .6rem .85rem;
  border: 0;
  background: transparent;
  font: inherit;
  color: var(--text);
  text-align: start;
  cursor: pointer;
  transition: background .15s;
}
.mail-row:hover { background: var(--surface-hover) }
/* Beside each row, what is done to a message without opening it: pin it,
   delete it (which asks once more in place). Quiet until the row is pointed
   at; a pin that is on always shows. */
.mail-item { display: flex; align-items: stretch }
.mail-item > .mail-row { flex: 1 1 auto; width: auto; min-width: 0 }
.mail-row-tools { display: flex; flex: none; align-items: center; gap: .1rem; padding-inline-end: .5rem }
button.mail-row-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .3rem;
  min-width: 1.9rem;
  height: 1.9rem;
  padding: 0 .35rem;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  box-shadow: none;
  font: inherit;
  font-size: .74rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  opacity: .5;
  transform: none;
  transition: opacity .15s, color .15s, background .15s, border-color .15s;
}
.mail-item:hover button.mail-row-tool,
button.mail-row-tool:focus-visible,
button.mail-row-tool.is-on,
button.mail-row-tool.is-confirming { opacity: 1 }
button.mail-row-tool:hover { border-color: transparent; background: var(--surface-flat-hover); color: var(--text) }
button.mail-row-tool:active { transform: none }
button.mail-row-tool:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px }
button.mail-row-tool:disabled { opacity: .4; cursor: default }
button.mail-row-tool svg { flex: none; width: 16px; height: 16px }
.mail-row-tool-icon { display: inline-flex }
.mail-row-tool-text[hidden] { display: none }
button.mail-row-pin.is-on { color: var(--accent) }
button.mail-row-pin.is-on svg path:first-child { fill: currentColor }
button.mail-row-delete:hover { color: var(--err) }
button.mail-row-delete.is-confirming,
button.mail-row-delete.is-confirming:hover {
  padding: 0 .55rem;
  border-color: var(--err);
  background: transparent;
  color: var(--err);
  font-weight: 600;
}
.mail-row-top { display: flex; align-items: baseline; gap: .6rem; min-width: 0 }
/* The subject leads the row, beside the time; who it is from is the line
   under it. */
.mail-from { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.mail-time { flex: none; font-size: .72rem; color: var(--muted) }
.mail-subject { flex: 1 1 auto; min-width: 0; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.mail-subject.has-attachments::after { content: " \1F4CE"; font-size: .78rem }
.mail-snippet { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis }
.mail-item.is-unread .mail-from,
.mail-item.is-unread .mail-subject { font-weight: 700 }
.mail-item.is-open .mail-subject,
.mail-item.is-open .mail-from { white-space: normal }
.mail-detail { padding: .2rem .85rem .85rem; border-top: 1px dashed var(--outline-subtle) }
.mail-outside { margin: .6rem 0; font-size: .76rem; color: var(--warn) }
.mail-detail-from { margin: 0 0 .5rem; font-size: .8rem; color: var(--muted); overflow-wrap: anywhere }
.mail-body {
  margin: 0;
  max-height: 28rem;
  overflow: auto;
  font: inherit;
  font-size: .88rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.mail-attachments { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .7rem; margin-top: .7rem }
.mail-attachments-title { margin: 0; font-size: .76rem; color: var(--muted) }
.mail-attachment { font-size: .82rem; color: var(--accent); overflow-wrap: anywhere }
.mail-actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .8rem }
/* Under the list: 'Show older' and, at its far end, 'Delete all' -- quiet
   until pointed at, since it empties the folder (mailbox.js asks first). */
.mail-list-foot { display: flex; align-items: center; gap: .6rem; margin-top: .7rem }
.mail-list-foot[hidden] { display: none }
.mail-more { margin: 0 }
button.mail-clear {
  margin-inline-start: auto;
  transform: none;
}
/* The read action uses the same quiet footer button, immediately before the bin. */
button.mail-mark-read:not([hidden]) + button.mail-clear { margin-inline-start: 0 }
button.mail-clear:active { transform: none }
button.mail-clear[hidden] { display: none }
.mail-clear-icon { display: inline-flex }
.mail-clear-icon svg { width: 15px; height: 15px }
/* Technical details: one fact per line, its name and what it stands at. */
.mail-tech { display: flex; flex-direction: column; gap: .35rem }
.mail-tech-row { display: flex; flex-wrap: wrap; gap: .2rem .8rem; font-size: .86rem }
.mail-tech-label { flex: 0 0 13rem; color: var(--muted) }
.mail-tech-value { flex: 1 1 14rem; min-width: 0; overflow-wrap: anywhere }
.mail-tech-row.is-warn .mail-tech-value { color: var(--warn) }
/* What happens when mail arrives: one choice per line. */
.mail-choices { display: flex; flex-direction: column; gap: .15rem }
.mail-choice {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .5rem .6rem;
  border-radius: 8px;
  font-size: .86rem;
  cursor: pointer;
}
.mail-choice:hover { background: var(--surface-flat-hover) }
/* base.css styles every <input> as a full-width text field (width: 100%,
   padding, border); a radio must opt out of all of that or it fills the row
   and pushes its own text off the card. */
.mail-choice input {
  flex: none;
  width: auto;
  min-width: 0;
  height: auto;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  accent-color: var(--accent);
  cursor: pointer;
}
.mail-choice input:focus { box-shadow: none }
.mail-choice > span { flex: 1 1 auto; min-width: 0 }
.mail-choice input:disabled + span { color: var(--muted) }
/* Whose e-mailed instructions the agent carries out: one box, there only
   while the switch is on -- the addresses as one bordered column, each with
   its remove button, then the field that adds one and the fine print. */
.mail-trusted {
  margin-top: .9rem;
  padding: .85rem .9rem .9rem;
  border: 1px solid var(--outline-subtle);
  border-radius: 10px;
  background: var(--surface-subtle);
}
.mail-trusted[hidden] { display: none }
.mail-trusted-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; margin-bottom: .55rem }
.mail-senders-heading { margin: 0; font-size: .86rem; font-weight: 600 }
.mail-senders-count { flex: none; font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums }
.mail-senders {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--outline-subtle);
  border-radius: 8px;
  background: var(--bg);
  overflow: hidden;
}
.mail-sender {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .6rem;
  padding: .3rem .35rem .3rem .7rem;
  border-top: 1px solid var(--outline-subtle);
}
.mail-sender:first-child { border-top: 0 }
.mail-sender-address {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: .86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mail-sender-remove {
  flex: none;
  width: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  font: inherit;
  font-size: .95rem;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
  transition: color .15s, background .15s;
}
.mail-sender-remove:hover { color: var(--err); background: var(--surface-flat-hover) }
.mail-sender-remove:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px }
.mail-sender-remove:disabled { opacity: .5; cursor: default }
.mail-senders-empty { margin: 0; padding: .6rem .7rem }
.mail-sender-form { display: flex; gap: .5rem; margin: .6rem 0 0 }
.mail-sender-input {
  flex: 1;
  min-width: 0;
  padding: .45rem .6rem;
  border: 1px solid var(--border2);
  border-radius: 8px;
  background: var(--bg);
  color: inherit;
  font: inherit;
  font-size: .86rem;
}
.mail-sender-note { margin: .45rem 0 0; color: var(--warn) }
.mail-trusted-proof { margin: .75rem 0 0 }
/* The fold under the fine print: what DMARC is and whose mail passes it.
   The caret and the summary's ink are the panel's own (settings.css). */
details.mail-proof-help:not(.panel-section) { margin: .45rem 0 0; padding: 0; border: 0 }
.mail-proof-help > summary { width: fit-content }
.mail-proof-help[open] > summary { color: var(--text) }
.mail-proof-help > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px }
.mail-proof-help > p,
.mail-proof-help > ul { margin: 0; color: var(--muted); font-size: .82rem; line-height: 1.5 }
.mail-proof-help > ul { margin-top: .45rem; padding-left: 1.15rem }
.mail-proof-help li + li { margin-top: .3rem }
@media (max-width: 520px) {
  .mail-sender-form { flex-direction: column }
}
/* Whose mail the list shows: the projects' picker wears the background
   jobs' look (settings.css, .jobs-scope). For one project the address that
   files mail straight into its folder lies ON the picker, before its
   chevron, and a click on it copies it. A button cannot hold a button, so
   the address is the picker's sibling in the same grid cell, and the picker
   keeps its room with an unseen copy of it (.mail-project-address-space):
   the two share every measure below, so one lies exactly over the other.
   The right margin is the picker's own border, padding, chevron and gap.
   Where the picker itself is narrow -- its own width, not the screen's: the
   dialog is narrower than the window -- the address takes the line under
   it, and the project's name keeps its room. */
.mail-scope { margin: .1rem 0 .8rem; container-type: inline-size }
.mail-scope .jobs-scope-bar { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 }
.mail-scope .jobs-scope-btn { grid-area: 1 / 1 }
.mail-scope .mail-project-address,
.mail-project-address-space {
  box-sizing: border-box;
  flex: 0 0 auto;
  padding: .2rem .55rem;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: .84rem;
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: 0;
  white-space: nowrap;
}
.mail-project-address-space { visibility: hidden }
.mail-scope .mail-project-address {
  grid-area: 1 / 1;
  justify-self: end;
  align-self: center;
  z-index: 1;
  margin: 0 calc(.7rem + 16px + .75rem + 1px) 0 0;
  border-color: var(--outline-subtle);
  background: var(--card);
}
.mail-scope .mail-project-address:hover { border-color: var(--accent); background: var(--card) }
.mail-scope .mail-project-address:active { transform: none }
@container (max-width: 560px) {
  .mail-project-address-space { display: none }
  .mail-scope .mail-project-address {
    grid-area: 2 / 1;
    justify-self: start;
    max-width: 100%;
    margin: .45rem 0 0;
    white-space: normal;
  }
}
/* The mailbox is everyone's only where there is an everyone: the sentence
   saying so shows on an agent with sharing on (member_view.js). */
.mail-shared-note { display: none }
body[data-shared-agent] .mail-shared-note { display: inline }
/* In the whole mailbox a project's mail names its project. */
.mail-project {
  flex: none;
  max-width: 40%;
  padding: .05rem .45rem;
  border: 1px solid var(--border2);
  border-radius: 999px;
  font-size: .68rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
