:root {
  --bg: #12131a;
  --panel: #1a1c26;
  --panel-2: #21242f;
  --border: #2c303d;
  --text: #e6e8f0;
  --muted: #8b90a3;
  --accent: #6aa3ff;
  --working: #5b8dff;
  --blocked: #ffa23a;
  --idle: #57c98a;
  --shell: #b98cff;
  --offline: #5d6270;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f6f7fa;
    --panel: #ffffff;
    --panel-2: #f0f2f7;
    --border: #dce0ea;
    --text: #191c25;
    --muted: #666d80;
    --offline: #a5abb9;
  }
}

* { box-sizing: border-box; }

/* Author styles beat the UA's [hidden] rule, so a display: flex/table element stays
   visible when hidden is set. Both view containers depend on this. */
[hidden] { display: none !important; }

body {
  margin: 0;
  padding: 20px 24px 60px;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", Segoe UI, sans-serif;
}

header {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 18px;
}

.title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
h1 { font-size: 20px; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 14px; margin: 0 0 10px; color: var(--muted); font-weight: 600; }
.summary { color: var(--muted); }
.muted { color: var(--muted); }
.actions { display: flex; align-items: center; gap: 12px; }

button {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button:disabled { opacity: 0.5; cursor: default; }

/* ---------------------------------------------------------------- hosts */

.hosts {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-bottom: 20px;
}

.host {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.host:hover { border-color: var(--accent); }
.host.down { border-color: #7c3a3a; }
.host .name { display: flex; align-items: center; gap: 7px; font-weight: 600; }
.host .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.host .err { color: #ff8f8f; font-size: 12px; margin-top: 4px; word-break: break-word; }

/* ------------------------------------------------------------- accounts */

.accounts { margin-bottom: 20px; }
.accounts > div {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}
.account {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.account.limited { border-color: var(--blocked); }
.account-head { display: flex; align-items: center; gap: 8px; justify-content: space-between; }
.account-limit { color: var(--blocked); font-size: 12px; margin-top: 5px; }
.account-foot { font-size: 12px; margin-top: 5px; }

.meter-row { margin-top: 8px; }
.meter-label { display: flex; justify-content: space-between; font-size: 12px; }
.meter-label b { font-variant-numeric: tabular-nums; }
.meter-label b.warn { color: var(--blocked); }
.meter-label b.crit { color: #ff7a7a; }
.meter {
  height: 6px;
  border-radius: 3px;
  background: var(--panel-2);
  overflow: hidden;
  margin-top: 3px;
}
.meter-fill { height: 100%; background: var(--idle); border-radius: 3px; }
.meter-fill.warn { background: var(--blocked); }
.meter-fill.crit { background: #ff7a7a; }
.meter-foot { font-size: 11px; margin-top: 2px; }

/* Per-session context window, shown inline in the table and on kanban cards. */
.ctx { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.ctx .meter { width: 52px; margin-top: 0; }

/* ------------------------------------------------------------ attention */

.attention { margin-bottom: 20px; }
.attention .card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--blocked);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
}
.attention .card .head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.attention .card .needs { margin-top: 4px; }
.attention .card.dismissed { border-left-color: var(--offline); opacity: 0.6; }
.attention .card .dismiss {
  margin-left: auto;
  border: none;
  background: none;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
  padding: 0 4px;
}
.attention .card .dismiss:hover { color: var(--text); }

button.linkish {
  border: none;
  background: none;
  color: var(--muted);
  font: inherit;
  font-weight: 400;
  padding: 0 0 0 6px;
  text-decoration: underline dotted;
}
button.linkish:hover { color: var(--accent); }

/* -------------------------------------------------------------- filters */

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}
.filters input[type="search"] { min-width: 260px; flex: 1 1 260px; }
input[type="search"], select {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  font: inherit;
}
.filters label { color: var(--muted); display: flex; align-items: center; gap: 6px; }

/* --------------------------------------------------------------- legend */

/* Two columns on a wide screen, one on a narrow one; the definition lists keep
   term and explanation on one line so the block stays scannable. */
.legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(340px, 1fr));
  gap: 6px 28px;
  margin: 0 0 14px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}
.legend h3 { margin: 10px 0 8px; font-size: 12px; text-transform: uppercase;
             letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
.legend .legend-col > h3:first-child { margin-top: 0; }
.legend dl { display: grid; grid-template-columns: max-content 1fr; gap: 5px 12px; margin: 0; }
.legend dt { color: var(--text); white-space: nowrap; }
.legend dt .dot { margin-right: 5px; vertical-align: middle; }
.legend dd { margin: 0; color: var(--muted); }
.legend p { margin: 10px 0 0; }
.legend code { background: var(--panel-2); border-radius: 4px; padding: 0 4px;
               font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }

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

.switch { display: flex; }
.switch button { border-radius: 0; }
.switch button:first-child { border-radius: 7px 0 0 7px; }
.switch button + button { margin-left: -1px; }
.switch button:last-child { border-radius: 0 7px 7px 0; }
.switch button.active { background: var(--panel); color: var(--accent); border-color: var(--accent); }

/* --------------------------------------------------------------- kanban */

/* The board is a grid of status columns repeated per machine: one header row, then a
   lane per host whose cells line up with it. */
.kanban { display: block; overflow-x: auto; padding-bottom: 12px; }

.board-head, .lane-cols { display: grid; gap: 12px; }

.board-head {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--bg);
  padding: 2px 0 8px;
  border-bottom: 1px solid var(--border);
}

.column-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 13px;
}
.column-head .count { color: var(--muted); font-weight: 400; margin-left: auto; }

.lane { margin-top: 14px; }
.lane-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 600;
  font-size: 13px;
  padding: 0 0 7px;
  color: var(--text);
}
.lane-head .count { color: var(--muted); font-weight: 400; font-size: 12px; }
.lane-cols { align-items: start; }
.cell {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  min-height: 44px;
}
/* A machine with nothing in a given status leaves a hole, not a panel. */
.cell:empty { background: none; border-color: transparent; }
.lane-detail {
  margin-top: 10px;
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.card-roster { font-size: 12px; margin-bottom: 3px; }

/* --------------------------------------------------------------- tickets */

.card.ticket { cursor: default; }
.card.ticket:hover { border-color: var(--border); }
.ticket-title { font-weight: 600; margin: 4px 0 2px; }
.badge.key { color: var(--text); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.prio { font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); }
.prio.high { color: var(--blocked); }
.prio.low { opacity: 0.7; }

.chips { display: flex; flex-direction: column; gap: 4px; margin: 7px 0 6px; }
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 2px 4px 2px 8px;
}
.chip a { color: var(--text); text-decoration: none; }
.chip a:hover { color: var(--accent); }
.chip.auto { border-style: dashed; }
.chip.missing { opacity: 0.55; }
.chip .muted { margin-left: auto; font-size: 11px; }
.chip .unlink {
  border: none;
  background: none;
  color: var(--muted);
  padding: 0 5px;
  font-size: 14px;
  line-height: 1;
  margin-left: auto;
}
.chip .unlink:hover { color: #ff7a7a; }
.link-picker { width: 100%; font-size: 12px; padding: 3px 6px; }

.kanban .card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  cursor: pointer;
}
.kanban .card:hover { border-color: var(--accent); }
.kanban .card.expanded { border-color: var(--accent); }
.kanban .card-head { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.kanban .card-title { font-weight: 600; }
.kanban .card-meta { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 5px 0 3px; font-size: 12px; }
.kanban .card .detail { max-width: none; font-size: 13px; }

/* ---------------------------------------------------------------- table */

table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
thead th[data-sort] { cursor: pointer; user-select: none; }
thead th[data-sort]:hover { color: var(--text); }
th.num, td.num { text-align: right; }
.col-dot { width: 18px; }
.col-link { width: 40px; }

tbody tr.session { cursor: pointer; border-bottom: 1px solid var(--border); }
tbody tr.session:hover { background: var(--panel); }
tbody td { padding: 7px 8px; vertical-align: top; }

.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--offline); }
.dot.working { background: var(--working); box-shadow: 0 0 0 3px rgba(91, 141, 255, 0.18); }
.dot.blocked { background: var(--blocked); box-shadow: 0 0 0 3px rgba(255, 162, 58, 0.18); }
.dot.idle { background: var(--idle); }
.dot.shell { background: var(--shell); }

.name-cell { font-weight: 600; max-width: 280px; }
.name-cell .sub { font-weight: 400; color: var(--muted); font-size: 12px; }
.path { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
/* Summaries pulled from a transcript can run long; the full text is in the expanded
   row, so the table keeps them to two lines to stay scannable. The clamp lives on an
   inner div — a table cell is not a reliable -webkit-box. */
.detail { color: var(--muted); max-width: 460px; }
.detail > div {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.detail.needs { color: var(--blocked); }
.detail.brief { max-width: 320px; }

.badge {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--panel-2);
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.badge.project { color: var(--text); }
.badge.acct-0 { color: #7fc4ff; border-color: #2f5578; }
.badge.acct-1 { color: #ffc07f; border-color: #7a5a2c; }
.badge.acct-2 { color: #9ee89e; border-color: #38663a; }
.badge.acct-3 { color: #e59bff; border-color: #6b3a7d; }

a.open {
  text-decoration: none;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 2px 7px;
  display: inline-block;
}
a.open:hover { border-color: var(--accent); }
a.open.shared { color: var(--muted); }
.open-placeholder { color: var(--offline); padding: 2px 7px; display: inline-block; cursor: help; }

/* --------------------------------------------------------------- detail */

tr.expanded td { background: var(--panel); box-shadow: inset 3px 0 0 var(--accent); }

/* The session panel: a fixed drawer on the right. Heading and actions stay put,
   everything long scrolls inside, and on a wide screen the page shrinks to make
   room instead of being covered. */
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(560px, 100vw);
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: -16px 0 48px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  z-index: 8;
}
@media (min-width: 1100px) {
  body { transition: padding-right 0.15s ease; }
  body.drawer-open { padding-right: calc(560px + 24px); }
}
.drawer-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.drawer-title { flex: 1; min-width: 0; }
.drawer-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.drawer-name h2 {
  font-size: 15px;
  color: var(--text);
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.drawer-sub {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
.drawer-actions {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--panel-2);
}
.drawer-actions .action-status { margin-top: 8px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 0 16px 28px; }
.drawer-section { padding: 12px 0; border-bottom: 1px solid var(--border); }
.drawer-section:last-child { border-bottom: none; }
.drawer-section h3 {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 8px;
}
/* An intent can be a whole pasted brief; it scrolls in place rather than pushing
   the rest of the panel away. */
.drawer-section p {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow-y: auto;
  font-size: 13px;
  line-height: 1.45;
}
.drawer-section p.needs { color: var(--blocked); }
a.open-btn {
  display: inline-block;
  text-decoration: none;
  color: var(--accent);
  background: var(--panel);
  border: 1px solid var(--accent);
  border-radius: 7px;
  padding: 6px 12px;
}
a.open-btn:hover { background: var(--accent); color: #fff; }
a.open-btn.shared { color: var(--muted); border-color: var(--border); }
button.primary { border-color: var(--accent); color: var(--accent); }
button.primary:hover { background: var(--accent); color: #fff; }
.cmd-list { display: flex; flex-direction: column; gap: 8px; }
.cmd-row .cmd-label { font-size: 11px; color: var(--muted); margin-bottom: 3px; }
.cmd-row.danger .cmd-label { color: #d98a8a; }
.drawer .cmd { margin-bottom: 0; }
.drawer .cmd code { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.drawer .cmd button { padding: 3px 9px; font-size: 12px; white-space: nowrap; }
.drawer .facts { font-size: 12px; row-gap: 4px; }
.drawer .facts dd { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
details.history summary {
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  list-style: none;
}
details.history summary::before { content: '▸ '; }
details.history[open] summary::before { content: '▾ '; }
details.history .events { max-height: 240px; overflow-y: auto; margin-top: 8px; }
.cmd {
  display: flex; gap: 8px; align-items: center; margin-bottom: 6px;
}
.cmd code {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow-x: auto;
  white-space: nowrap;
  flex: 1;
}
.facts { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; font-size: 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }

.events { margin: 0; padding: 0; list-style: none; font-size: 12px; }
.events li { display: flex; gap: 8px; padding: 2px 0; border-bottom: 1px solid var(--border); }
.events .when { color: var(--muted); white-space: nowrap; }
.empty { margin-top: 20px; }

@media (max-width: 900px) {
  body { padding: 14px; }
  th.hide-sm, td.hide-sm { display: none; }
  .detail { max-width: 220px; }
}

/* Phone: keep the essentials — dot, name, machine, what it's doing, the link. */
@media (max-width: 600px) {
  body { padding: 10px; font-size: 13px; }
  th.hide-xs, td.hide-xs { display: none; }
  header { gap: 8px; }
  .title { gap: 8px; }
  .actions { flex-wrap: wrap; gap: 8px; }
  .hosts { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
  .accounts > div { grid-template-columns: 1fr; }
  .filters input[type="search"] { min-width: 0; flex-basis: 100%; }
  tbody td { padding: 6px 5px; }
  .name-cell { max-width: 160px; }
  .detail { max-width: 150px; }
  .detail-grid { grid-template-columns: 1fr; }
  tr.detail-row > td { padding-left: 10px; }
  /* Команды длинные всегда — пусть скроллятся внутри своей строки. */
  .cmd { flex-wrap: wrap; }
  .cmd code { min-width: 0; }
  #tmux-table .cmd { max-width: none; }
  /* На телефоне сам текст команды не читают — «копировать» кладёт её в буфер. */
  #tmux-table .cmd code { display: none; }
  .modal { padding: 12px; max-height: 88vh; }
  .modal-overlay { padding: 4vh 8px; }
  .drawer { width: 100vw; }
  .graph-legend .graph-hint { display: none; }
  #graph { touch-action: pan-y; }
}

/* -------------------------------------------------------------- actions */

.actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
button.danger:hover { border-color: #ff7a7a; color: #ff7a7a; }
.action-status { font-size: 12px; margin-top: 6px; }
.action-status.ok { color: var(--idle); }
.action-status.err { color: #ff8f8f; }

/* ----------------------------------------------------------------- todo */

.todo-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
#todo-syncs { font-size: 12px; }
#todo-syncs .err { color: #ff8f8f; }
#todo-syncs .sep { color: var(--border); }
#todo-table .name-cell { max-width: 560px; }
.todo-key {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 600;
  font-size: 12px;
}
a.todo-key { color: var(--accent); text-decoration: none; }
a.todo-key:hover { text-decoration: underline; }
.todo-row.done { opacity: 0.55; }
.todo-row.done .name-cell > div:first-child { text-decoration: line-through; }
.todo-hot { color: #ff7a7a; font-weight: 700; }
.todo-actions { display: flex; gap: 2px; white-space: nowrap; }
.todo-actions .linkish { text-decoration: none; font-size: 14px; }
.todo-actions .linkish.danger:hover { color: #ff7a7a; }
select.todo-map { font-size: 12px; padding: 4px 6px; max-width: 220px; color: var(--muted); }
.tmux-session .linkish { text-decoration: none; }

/* ---------------------------------------------------------------- graph */

.graph-wrap {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
}
#graph {
  width: 100%;
  height: auto;
  display: block;
  cursor: grab;
  touch-action: none;
}
#graph:active { cursor: grabbing; }
#graph .edge { stroke: var(--border); stroke-width: 1.5; }
#graph .edge.live { stroke: var(--idle); opacity: 0.75; }
/* Traffic on a working branch flows, Kiali-style. */
#graph .edge.working { stroke: var(--working); stroke-dasharray: 5 7; animation: flow 1.1s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -12; } }
#graph .node circle { stroke-width: 2; }
#graph .node.host circle { fill: var(--panel-2); stroke: var(--accent); }
#graph .node.host.down circle { stroke: var(--offline); stroke-dasharray: 4 4; }
#graph .node.folder circle { fill: var(--bg); stroke: var(--muted); }
#graph .node.tmux { cursor: pointer; }
#graph .node.tmux rect { fill: var(--panel-2); stroke: var(--muted); stroke-width: 1.5; }
#graph .node.tmux:hover rect { stroke: var(--accent); }
#graph .node.tmux.empty rect { stroke-dasharray: 3 3; }
#graph .node.tmux.working rect { stroke: var(--working); }
#graph .node.tmux text.label { fill: var(--muted); font-size: 10px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.graph-legend .legend-tmux {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid var(--muted);
  border-radius: 2px;
  margin-right: 5px;
  vertical-align: middle;
}
#graph .node.session { cursor: pointer; }
#graph .node.session circle { fill: var(--offline); stroke: var(--panel); }
#graph .node.session.working circle { fill: var(--working); filter: drop-shadow(0 0 5px rgba(91, 141, 255, 0.8)); }
#graph .node.session.blocked circle { fill: var(--blocked); filter: drop-shadow(0 0 5px rgba(255, 162, 58, 0.8)); }
#graph .node.session.idle circle { fill: var(--idle); }
#graph .node.session.shell circle { fill: var(--shell); }
#graph .node.session.selected circle { stroke: var(--text); stroke-width: 3; }
#graph .node.session:hover circle { stroke: var(--accent); stroke-width: 3; }
#graph text { fill: var(--text); font-size: 12px; pointer-events: none; }
#graph text.count { fill: var(--muted); font-size: 11px; font-weight: 600; }
#graph .node.host text.label { font-weight: 700; font-size: 13px; }
#graph .node.folder text.label {
  fill: var(--muted);
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
#graph .node.session text { pointer-events: auto; font-size: 11px; }
#graph .node.session.offline text { fill: var(--muted); }
.graph-legend { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; margin-top: 8px; font-size: 12px; }
.graph-legend .dot { margin-right: 4px; vertical-align: middle; }
.graph-legend .graph-hint { margin-left: auto; }

/* ----------------------------------------------------------------- tmux */

#tmux-table .cmd { margin-bottom: 0; max-width: 480px; }
.tmux-session { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.tmux-session a { color: var(--text); text-decoration: none; font-weight: 600; }
.tmux-session a:hover { color: var(--accent); }
.tmux-session a.open { color: var(--accent); font-weight: 400; }

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

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 8vh 16px;
  z-index: 10;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  width: 100%;
  max-width: 460px;
  max-height: 80vh;
  overflow-y: auto;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.modal-head h2 { font-size: 15px; margin: 0; }
.modal-x {
  border: none;
  background: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
}
.modal-x:hover { color: var(--text); }

#launch-form, #todo-form { display: flex; flex-direction: column; gap: 10px; }
#launch-form label, #todo-form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
#launch-form label.checkbox { flex-direction: row; align-items: center; gap: 7px; }
.agent-pick { display: flex; gap: 16px; }
.agent-pick label { flex-direction: row; align-items: center; gap: 6px; }
#launch-form input[type="text"],
#launch-form select,
#launch-form textarea,
#todo-form input[type="text"],
#todo-form textarea {
  background: var(--panel-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 7px 9px;
  font: inherit;
  width: 100%;
}
#launch-form textarea, #todo-form textarea { resize: vertical; }

/* Folder history under the cwd input: pick a row, or cross out a mistyped one. */
.cwd-history { display: flex; flex-direction: column; gap: 1px; margin-top: -6px; }
.cwd-item { display: flex; align-items: center; min-width: 0; }
.cwd-pick {
  border: none;
  background: none;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 3px 6px;
  text-align: left;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-radius: 5px;
}
.cwd-pick:hover { color: var(--accent); background: var(--panel-2); }
.cwd-del {
  border: none;
  background: none;
  color: var(--muted);
  padding: 0 6px;
  font-size: 14px;
  line-height: 1;
}
.cwd-del:hover { color: #ff7a7a; }
#launch-status, #todo-status-line { font-size: 12px; min-height: 1em; }
#launch-status.ok { color: var(--idle); }
#launch-status.err, #todo-status-line.err { color: #ff8f8f; }
#launch-status .cmd { margin-top: 6px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

/* Пояснение рядом с кнопками действий (веб-архив и т.п.) */
.action-note { font-size: 12px; align-self: center; }
