:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --panel-2: #f1f3f6;
  --line: #e2e5ea;
  --text: #1b1f24;
  --muted: #5f6873;
  --faint: #8b939d;
  --accent: #2f6f4f;
  --accent-2: #3f8f66;
  --accent-soft: #e5f1ea;
  --ok: #2e8b57;
  --warn: #b7791f;
  --bad: #c0392b;
  --bad-soft: #fbeaea;
  --warn-soft: #fdf3e2;
  --cpu: #3b82c4;
  --mem: #8b5cc4;
  --gpu: #2f9e6e;
  --vram: #d08a2e;
  --side: #17211c;
  --side-text: #c9d4ce;
  --side-muted: #7f8f86;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(16, 24, 32, .06);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111416;
    --panel: #181c1f;
    --panel-2: #1f2427;
    --line: #2b3135;
    --text: #e4e8eb;
    --muted: #a0a9b0;
    --faint: #6f7a82;
    --accent: #5fb88a;
    --accent-2: #74c89c;
    --accent-soft: #1d2e25;
    --bad-soft: #3a1f1d;
    --warn-soft: #3a2f1b;
    --side: #0c0f10;
    --shadow: none;
    color-scheme: dark;
  }
}
/* the same, when chosen on the Account page (data-theme, layout.html) */
:root[data-theme="dark"] {
    --bg: #111416;
    --panel: #181c1f;
    --panel-2: #1f2427;
    --line: #2b3135;
    --text: #e4e8eb;
    --muted: #a0a9b0;
    --faint: #6f7a82;
    --accent: #5fb88a;
    --accent-2: #74c89c;
    --accent-soft: #1d2e25;
    --bad-soft: #3a1f1d;
    --warn-soft: #3a2f1b;
    --side: #0c0f10;
    --shadow: none;
    color-scheme: dark;
  }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
code, pre, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { background: var(--panel-2); padding: 10px 12px; border-radius: 6px; overflow-x: auto; margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 16px 0; }
[hidden] { display: none !important; }

/* ---- shell ---- */
:root { --top: 52px; }
.shell { --side-w: 196px; display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .18s ease; }
.side {
  background: var(--side); color: var(--side-text);
  display: flex; flex-direction: column; padding: 14px 8px; font-size: 13.5px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto; overflow-x: hidden;
}
.brand { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 650; font-size: 14.5px; padding: 4px 8px 10px; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand small { display: block; font-weight: 400; font-size: 11.5px; color: var(--side-muted); }
.side-section { display: flex; flex-direction: column; min-height: 0; }
.side-admin { margin-top: auto; padding-top: 12px; }
.side nav { display: flex; flex-direction: column; gap: 1px; }
.side nav a {
  color: var(--side-text); padding: 6px 9px; border-radius: 6px;
  display: flex; align-items: center; gap: 8px; min-width: 0;
}
.side nav a:hover { background: rgba(255, 255, 255, .06); text-decoration: none; }
.side nav a.on { background: rgba(255, 255, 255, .1); color: #fff; }
.side nav .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--side-muted); flex: none; }
.side nav .dot.up { background: #4cc38a; }
.side nav .dot.down { background: #e5534b; }
/* Dozens of nodes: the list scrolls on its own and the Admin links stay in view. */
.node-nav { max-height: min(50vh, 440px); overflow-y: auto; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--side-muted); padding: 14px 10px 4px; display: flex; justify-content: space-between; }
.nav-label a { color: inherit; }
.nav-label a:hover { color: #fff; text-decoration: none; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.count {
  margin-left: auto; background: var(--accent-2); color: #fff; font-size: 11px; font-weight: 650;
  border-radius: 10px; padding: 0 7px; line-height: 18px; min-width: 18px; text-align: center;
}

.frame { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 40; height: var(--top);
  display: flex; align-items: stretch; gap: 16px; padding: 0 24px 0 20px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.tabs { display: flex; align-items: stretch; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: flex; align-items: center; gap: 7px; padding: 0 12px; white-space: nowrap;
  color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.tabs .count { margin-left: 0; }
.me { display: flex; align-items: center; gap: 12px; flex: none; }
.me a { color: var(--text); display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 200px; font-weight: 550; }
.me a:hover { text-decoration: none; }
.me button { color: var(--muted); }

.main { padding: 28px 32px 60px; max-width: 980px; width: 100%; }
.main.wide { max-width: 1400px; }

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; } /* short pages: the top bar keeps its height */
  .side { position: static; height: auto; flex-direction: row; align-items: center; padding: 8px 12px; gap: 4px; overflow: visible; }
  .brand { padding: 4px 6px; }
  .brand small { display: none; }
  .side-nodes { display: none; } /* the Nodes tab lists them */
  .side-admin { margin: 0 0 0 auto; padding: 0; }
  .side nav { flex-direction: row; overflow-x: auto; }
  .side nav a { white-space: nowrap; padding: 6px 9px; }
  .nav-label { display: none; }
  .topbar { padding: 0 8px; gap: 8px; }
  .tabs a { padding: 0 9px; }
  .me a .ellipsis { display: none; }
  .main { padding: 18px 16px 48px; }
}

/* ---- common blocks ---- */
.head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.head h1 { margin: 0; }
.head .sub { color: var(--muted); margin-top: 3px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px 18px; }
.panel + .panel, .panel + .grid, .grid + .panel, .grid + .grid { margin-top: 16px; }
.panel > h2:first-child { margin-bottom: 12px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.panel-head h2 { margin: 0; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.cols-main { grid-template-columns: minmax(0, 1fr) 300px; align-items: start; }
@media (max-width: 1000px) { .cols-main { grid-template-columns: 1fr; } }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

.flash { padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: var(--accent-soft); border-color: transparent; color: var(--text); }
.flash.err, .error { background: var(--bad-soft); border-color: transparent; color: var(--text); }
.error { padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }
.notice { background: var(--warn-soft); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; }

/* ---- forms ---- */
label { display: block; font-weight: 550; margin-bottom: 4px; font-size: 13px; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=date], input:not([type]), select, textarea {
  width: 100%; font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px;
}
textarea { min-height: 120px; resize: vertical; line-height: 1.45; }
textarea.mono { font-family: var(--mono); font-size: 12.5px; }
/* Dropdowns: our own arrow, with room on the right, in the theme's colours
   (Ilya, 2026-10-05: the browser's arrow was glued to the right edge). */
select {
  -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 13px) 55%;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
select[multiple], select[size] { -webkit-appearance: auto; appearance: auto; padding-right: 10px; background-image: none; }
select:disabled { cursor: default; opacity: .6; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 180px; }
.inline { display: inline; }
.btn, button {
  font: inherit; font-weight: 550; cursor: pointer; border-radius: 6px; padding: 7px 14px;
  border: 1px solid var(--line); background: var(--panel); color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; line-height: 1.3; white-space: nowrap;
}
.btn:hover, button:hover { background: var(--panel-2); text-decoration: none; }
.btn.primary, button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover, button.primary:hover { background: var(--accent-2); }
.btn.danger, button.danger { color: var(--bad); }
.btn.small, button.small { padding: 4px 10px; font-size: 12.5px; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 400; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.filters select, .filters input { width: auto; min-width: 140px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg a, .seg button { padding: 5px 11px; color: var(--muted); border: 0; border-radius: 0; background: var(--panel); font-weight: 500; }
.seg a + a, .seg button + button { border-left: 1px solid var(--line); }
.seg a.on, .seg button.on { background: var(--accent-soft); color: var(--text); }
.seg a:hover { text-decoration: none; background: var(--panel-2); }

/* ---- tables ---- */
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-weight: 550; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.panel.flush { padding: 4px 0; }
.panel.flush th:first-child, .panel.flush td:first-child { padding-left: 18px; }
.panel.flush th:last-child, .panel.flush td:last-child { padding-right: 18px; }
tbody tr:hover { background: var(--panel-2); }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
dl.kv dt { color: var(--muted); }
dl.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---- badges & avatars ---- */
.badge { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 1px 8px; border-radius: 10px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.badge.open { background: #e6eef8; color: #2c5d8f; }
.badge.in_progress { background: #efe7f8; color: #6a3fa0; }
.badge.blocked { background: var(--bad-soft); color: var(--bad); }
.badge.done { background: var(--accent-soft); color: var(--accent); }
.badge.urgent { background: var(--bad); color: #fff; }
.badge.high { background: var(--warn-soft); color: var(--warn); }
.badge.low { color: var(--faint); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge.open { background: #1c2a3a; color: #8db8e6; }
  :root:not([data-theme="light"]) .badge.in_progress { background: #2a2038; color: #c2a3ea; }
}
/* the same, when chosen on the Account page (data-theme, layout.html) */
:root[data-theme="dark"] .badge.open { background: #1c2a3a; color: #8db8e6; }
:root[data-theme="dark"] .badge.in_progress { background: #2a2038; color: #c2a3ea; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 550; }
.status::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.status.up::before { background: var(--ok); box-shadow: 0 0 0 3px rgba(46, 139, 87, .18); }
.status.down::before { background: var(--bad); }
.avatar {
  width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff;
  display: inline-grid; place-items: center; font-size: 11px; font-weight: 650; flex: none;
}
.avatar.sm { width: 22px; height: 22px; font-size: 10px; }

/* ---- markdown ---- */
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p, .md ul, .md ol, .md pre, .md table, .md blockquote { margin: 0 0 .7em; }
.md ul, .md ol { padding-left: 1.4em; }
.md blockquote { border-left: 3px solid var(--line); padding-left: 12px; color: var(--muted); }
.md code { background: var(--panel-2); padding: 1px 4px; border-radius: 4px; }
.md pre code { background: none; padding: 0; }
.md table { width: auto; }
.md th, .md td { border: 1px solid var(--line); padding: 4px 8px; }
.md img { max-width: 100%; }

/* ---- auth pages ---- */
body.bare { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth { width: 100%; max-width: 380px; }
.auth .panel { padding: 28px 28px 24px; }
.auth .brand { color: var(--text); justify-content: center; padding: 0 0 20px; font-size: 17px; }
.auth h1 { font-size: 18px; text-align: center; }
.auth .lead { color: var(--muted); text-align: center; margin: -4px 0 18px; }
.auth button.primary { width: 100%; justify-content: center; padding: 9px; margin-top: 4px; }
.code-input { font-family: var(--mono); font-size: 24px !important; letter-spacing: .35em; text-align: center; padding: 10px !important; }
.auth-foot { margin-top: 16px; text-align: center; font-size: 12.5px; color: var(--muted); }

/* ---- nodes ---- */
.bar { height: 7px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: 4px; transition: width .4s ease; }
.bar.cpu > i { background: var(--cpu); }
.bar.mem > i { background: var(--mem); }
.bar.gpu > i { background: var(--gpu); }
.bar.vram > i { background: var(--vram); }
.bar.disk > i { background: var(--faint); }
.bar > i.hot { background: var(--bad) !important; }
.legend { display: flex; gap: 12px; font-size: 11.5px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 4px; }

.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.tile .k { color: var(--muted); font-size: 12px; }
.tile .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; margin: 2px 0 6px; }
.tile .v small { font-size: 12.5px; font-weight: 400; color: var(--muted); }

.chart { position: relative; }
.chart svg { width: 100%; height: 220px; display: block; overflow: visible; }
.chart .tip {
  position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 9px; font-size: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .12); white-space: nowrap;
}
.chart text { fill: var(--faint); font-size: 10.5px; }
/* A node's CPU threads: one small segmented column each (CORE in nodes.js). */
.cores { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 4px; }
.core {
  position: relative; overflow: hidden; flex: 1 1 6px; min-width: 6px; max-width: 24px; height: calc(16 * 5px - 2px); background: var(--line);
  -webkit-mask: repeating-linear-gradient(to top, #000 0 3px, transparent 3px 5px);
  mask: repeating-linear-gradient(to top, #000 0 3px, transparent 3px 5px);
}
.core i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--cpu); transition: height .6s cubic-bezier(.2, .8, .2, 1); }
.core i.hot { background: var(--bad); }
.node-err { font-size: 12px; color: var(--bad); overflow-wrap: anywhere; margin-top: 8px; }
.node-err:empty { display: none; }

/* ---- overview (dashboard.html, nodes.js) ---- */
/* Totals and the GPU cards side by side; the cards take a row of their own
   once there are more than a few (.wide, set by nodes.js). */
.dash-top { display: flex; flex-wrap: wrap; gap: 14px; align-items: stretch; }
.dash-top .kpis { flex: 1 1 480px; grid-template-columns: repeat(3, minmax(0, 1fr)); align-content: start; }
.dash-top .eq-panel { flex: 1 1 340px; display: flex; flex-direction: column; }
.dash-top.wide .eq-panel { flex-basis: 100%; }
.dash-top.wide .kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.dash-top:not(.wide) .kpis { grid-auto-rows: 1fr; align-content: stretch; } /* as tall as the cards beside them */
.dash-top[data-node-detail]:not(.wide) .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kpi { display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 12px 14px 13px; min-width: 0; }
.kpi .k { color: var(--muted); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.kpi .v { font-size: 26px; font-weight: 650; line-height: 1.2; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v small { font-size: 13px; font-weight: 450; color: var(--muted); }
.kpi .s { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .bar { height: 5px; margin-top: auto; }
.kpi .s { padding-bottom: 9px; }
.st-bad { color: var(--text); font-weight: 550; }
a.st-bad:hover { text-decoration: underline; }
.st-bad::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); margin-right: 6px; vertical-align: 1px; }

/* The GPU cards, like an equaliser, on a dark screen in both looks. Segment
   sizes per density (--n segments of --p px, --seg lit) match EQ in nodes.js. */
.eq-panel {
  --eq-bg: #131b17; --eq-line: #24302a; --eq-off: rgba(255, 255, 255, .075);
  --eq-lo: #1f8a5b; --eq-hi: #63dc9f; --eq-red: #f0584e; --eq-vram: #e2a149;
  --eq-text: #d5ddd8; --eq-muted: #879890;
  position: relative; color: var(--eq-text); border: 1px solid var(--eq-line); border-radius: var(--radius); padding: 14px 18px 16px;
  background: radial-gradient(120% 140% at 50% 0%, rgba(99, 220, 159, .07), transparent 60%) var(--eq-bg);
}
.eq-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; margin-bottom: 14px; }
.eq-head h2 { margin: 0; color: #fff; }
.eq-legend { display: flex; gap: 6px 14px; flex-wrap: wrap; font-size: 11.5px; color: var(--eq-muted); }
.eq-legend i { display: inline-block; vertical-align: -1px; margin-right: 5px; }
.lg-load { width: 8px; height: 11px; background: repeating-linear-gradient(to top, var(--eq-hi) 0 3px, transparent 3px 4px); }
.lg-hot { width: 8px; height: 11px; background: repeating-linear-gradient(to top, var(--eq-red) 0 3px, transparent 3px 4px); }
.lg-vmem { width: 3px; height: 11px; border-radius: 1px; background: var(--eq-vram); }
.eq { --n: 20; --p: 6px; --seg: 4px; --w: 16px; --mw: 5px; --cg: 8px; display: flex; flex-wrap: wrap; align-items: flex-end; gap: 18px 16px; margin-top: auto; }
.eq-xl { --w: 22px; --mw: 6px; --cg: 12px; justify-content: space-evenly; }
.eq-m { --n: 10; --p: 8px; --seg: 6px; --w: 10px; --mw: 3px; --cg: 5px; gap: 14px 12px; }
.eq-s { --n: 10; --p: 5px; --seg: 3px; --w: 6px; --mw: 2px; --cg: 3px; gap: 10px 8px; }
.eq-group { display: flex; flex-direction: column; min-width: 0; }
.eq-cards { display: flex; justify-content: center; gap: var(--cg); }
.eq-card { display: flex; flex-direction: column; align-items: center; gap: 5px; color: inherit; border-radius: 3px; outline-offset: 3px; }
.eq-card:hover { text-decoration: none; }
.eq-card:hover .eq-load, .eq-card:focus-visible .eq-load { --eq-off: rgba(255, 255, 255, .15); }
.eq-bars { display: flex; align-items: flex-end; gap: 3px; }
.eq-load, .eq-mem { position: relative; overflow: hidden; height: calc(var(--n) * var(--p) - var(--p) + var(--seg)); background: var(--eq-off); }
.eq-load {
  width: var(--w);
  -webkit-mask: repeating-linear-gradient(to top, #000 0 var(--seg), transparent var(--seg) var(--p));
  mask: repeating-linear-gradient(to top, #000 0 var(--seg), transparent var(--seg) var(--p));
}
.eq-mem { width: var(--mw); border-radius: 2px; }
.eq-fill, .eq-peak, .eq-mem > i { position: absolute; left: 0; right: 0; bottom: 0; }
.eq-fill {
  height: 0; transition: height .6s cubic-bezier(.2, .8, .2, 1);
  background: linear-gradient(to top, var(--eq-lo), var(--eq-hi) 89.9%, var(--eq-red) 90%) bottom / 100% calc(var(--n) * var(--p)) no-repeat;
}
.eq-peak { height: var(--seg); background: var(--eq-hi); transition: bottom .6s ease, opacity .3s; }
.eq-peak.hot { background: var(--eq-red); }
.eq-peak.idle { opacity: 0; }
.eq-mem > i { height: 0; border-radius: 2px; background: var(--eq-vram); transition: height .6s ease; }
.eq-val { font-size: 10.5px; line-height: 1; color: var(--eq-muted); font-variant-numeric: tabular-nums; }
.eq-name {
  margin-top: 7px; padding-top: 5px; border-top: 1px solid rgba(255, 255, 255, .14); min-width: 48px; max-width: 120px;
  font-size: 11.5px; color: var(--eq-text); text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.eq-name:hover { color: #fff; text-decoration: none; }
/* A node's page: each card's model, memory, temperature and power under it. */
.eq-one { justify-content: space-evenly; }
.eq-cap { display: flex; flex-direction: column; align-items: center; margin-top: 3px; font-size: 11px; line-height: 1.4; color: var(--eq-muted); white-space: nowrap; }
.eq-cap b { color: var(--eq-text); font-weight: 600; font-size: 11.5px; }
.eq-one .eq-card { outline-offset: 4px; }
.eq-m .eq-val { display: none; }
.eq-m .eq-name { min-width: 36px; max-width: 84px; margin-top: 5px; padding-top: 3px; font-size: 10.5px; }
.eq-s .eq-val, .eq-s .eq-name { display: none; }
.eq-group.off .eq-cards { opacity: .35; }
.eq-group.off .eq-name::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--eq-red); margin-right: 5px; vertical-align: 1px; }
.eq-tip {
  position: absolute; z-index: 5; pointer-events: none; white-space: nowrap; font-size: 12px; line-height: 1.45;
  background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
}

/* One small tile per machine; denser past 24 of them. */
.ntiles-head { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 12px; }
.ntiles-head h2 { margin: 0 auto 0 0; }
.ntiles-head .seg button span { color: var(--faint); margin-left: 2px; font-variant-numeric: tabular-nums; }
.ntiles-head .nt-filter { width: 200px; }
.ntiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.ntile {
  display: flex; flex-direction: column; gap: 3px; min-width: 0; cursor: pointer; padding: 11px 13px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); transition: border-color .15s, box-shadow .15s;
}
.ntile:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); box-shadow: 0 4px 14px rgba(16, 24, 32, .08); }
.ntile.off { box-shadow: inset 3px 0 0 var(--bad); }
.ntile.off .nt-meters { opacity: .4; }
.nt-top { display: flex; align-items: center; gap: 7px; min-width: 0; }
.nt-top .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.nt-top .dot.up { background: var(--ok); box-shadow: 0 0 0 3px rgba(46, 139, 87, .16); }
.nt-top .dot.down { background: var(--bad); }
.nt-name { font-weight: 650; font-size: 14.5px; color: var(--text); min-width: 0; }
.nt-tag { flex: none; font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; }
.nt-right { flex: none; margin-left: auto; display: flex; align-items: center; gap: 6px; }
.nt-state { font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.nt-state.bad { color: var(--bad); font-weight: 550; }
.nt-term { display: inline-flex; padding: 3px; margin: -3px -4px -3px 0; border-radius: 5px; color: var(--muted); }
.nt-term:hover { background: var(--panel-2); color: var(--text); }
.nt-role { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.nt-meters { display: grid; gap: 5px; }
.nt-m { display: grid; grid-template-columns: 32px 1fr 66px; align-items: center; gap: 8px; font-size: 11.5px; }
.nt-m .name { color: var(--muted); }
.nt-m .val { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.nt-m .bar { height: 5px; }
.nt-cards { display: flex; align-items: flex-end; gap: 3px; height: 16px; }
.nt-cards span { position: relative; width: 7px; height: 100%; border-radius: 2px; overflow: hidden; background: var(--line); }
.nt-cards i { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: var(--gpu); transition: height .6s cubic-bezier(.2, .8, .2, 1); }
.nt-cards i.hot { background: var(--bad); }
.nt-err { font-size: 11.5px; color: var(--bad); overflow-wrap: anywhere; }
.nt-err:empty { display: none; }
/* Past 24 machines each tile is two lines: name, then four small bars whose
   numbers show on hover. */
.ntiles.many { gap: 8px; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.ntiles.many .ntile { padding: 8px 10px 9px; gap: 7px; }
.ntiles.many .nt-name { font-size: 13px; }
.ntiles.many .nt-state { font-size: 10.5px; }
.ntiles.many .nt-state:not(.bad) { display: none; } /* no room for the uptime; offline still says so */
.ntiles.many .nt-role, .ntiles.many .nt-err, .ntiles.many .nt-m .val { display: none; }
.ntiles.many .nt-meters { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 9px; align-items: end; }
.ntiles.many .nt-m { grid-template-columns: minmax(0, 1fr); gap: 3px; font-size: 10px; line-height: 1; }
.ntiles.many .nt-m .bar { height: 4px; }
.ntiles.many .nt-cards { height: 12px; gap: 2px; }
.ntiles.many .nt-cards span { width: 4px; }
@media (max-width: 560px) {
  .dash-top .kpis, .dash-top.wide .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ntiles-head .seg { order: 3; }
  .ntiles-head .nt-filter { width: 100%; order: 4; }
}

/* ---- tickets ---- */
.ticket-title { font-weight: 550; color: var(--text); }
.ticket-meta { font-size: 12px; color: var(--muted); }
.timeline { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }
.comment { display: grid; grid-template-columns: 26px 1fr; gap: 10px; }
.comment .body { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.comment .who { padding: 7px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); background: var(--panel-2); border-radius: var(--radius) var(--radius) 0 0; }
.comment .who b { color: var(--text); }
.comment .md { padding: 10px 12px; }
.event { font-size: 12.5px; color: var(--muted); padding-left: 36px; position: relative; }
.event::before { content: ""; position: absolute; left: 11px; top: 7px; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); }
.side-fields .field { margin-bottom: 10px; }
.progress { height: 8px; border-radius: 4px; background: var(--panel-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); }

/* ---- chat ---- */
.chat { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 0; height: calc(100vh - 56px); border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.chat-side { border-right: 1px solid var(--line); padding: 12px 8px; overflow-y: auto; background: var(--panel-2); }
.chat-side h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 10px 8px 4px; font-weight: 600; }
.chat-side a { display: flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 6px; color: var(--text); }
.chat-side a:hover { background: var(--panel); text-decoration: none; }
/* The open conversation: a clear tint of the accent and a bar on its edge, in
   both looks (Ilya, 2026-10-01: "should be more pronounced"). */
.chat-side a.on, .chat-side a.on:hover { background: color-mix(in srgb, var(--accent) 24%, var(--panel)); box-shadow: inset 3px 0 0 var(--accent); font-weight: 650; }
.chat-side a.unread { font-weight: 650; }
.chat-side details { margin: 10px 8px; font-size: 12.5px; }
.chat-side details input { margin: 6px 0; }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-head { padding: 12px 18px; border-bottom: 1px solid var(--line); }
.chat-head h1 { font-size: 16px; margin: 0; }
.chat-head .topic { color: var(--muted); font-size: 12.5px; }
.msgs { flex: 1; overflow-y: auto; padding: 12px 18px; display: flex; flex-direction: column; }
.msg { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 6px 0; }
.msg .avatar { width: 30px; height: 30px; }
.msg .meta { font-size: 12.5px; color: var(--muted); }
.msg .meta b { color: var(--text); margin-right: 6px; }
.msg.cont { padding-top: 0; }
.msg.cont .avatar, .msg.cont .meta { visibility: hidden; height: 0; }
.composer { border-top: 1px solid var(--line); padding: 10px 14px; display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { min-height: 42px; max-height: 200px; height: 42px; }
.composer .hint { font-size: 11.5px; color: var(--faint); }
@media (max-width: 860px) {
  .chat { grid-template-columns: 1fr; height: auto; }
  .chat-side { border-right: 0; border-bottom: 1px solid var(--line); max-height: 180px; }
  .msgs { max-height: 60vh; }
}

/* ---- vault ---- */
.secret { font-family: var(--mono); background: var(--panel-2); padding: 8px 10px; border-radius: 6px; white-space: pre-wrap; overflow-wrap: anywhere; min-height: 36px; }
.secret.masked { color: var(--faint); letter-spacing: .2em; }
.kind { font-size: 11.5px; color: var(--muted); }
.danger-zone { border-color: var(--bad-soft); }
.danger-zone summary { cursor: pointer; color: var(--bad); font-weight: 550; }
.temp-pw { font-family: var(--mono); font-size: 18px; background: var(--panel-2); padding: 10px 14px; border-radius: 6px; user-select: all; display: inline-block; margin: 6px 0; }

.gap-top { margin-top: 16px; }
.lg-cpu { background: var(--cpu); }
.lg-mem { background: var(--mem); }
.lg-gpu { background: var(--gpu); }
.lg-vram { background: var(--vram); }
.ms-row + .ms-row { margin-top: 14px; }
.ms-row .panel-head { margin-bottom: 5px; }
.overdue { color: var(--bad); font-weight: 550; }
.gap-xs { margin-top: 6px; }
.center { text-align: center; display: block; padding: 6px 0; }
.grow { flex: 1; min-width: 0; }
.main:has(.chat) { padding: 16px; max-width: none; } /* the same gap on every side of the chat window */
.chat { height: calc(100vh - var(--top) - 32px); } /* 16px above and below */
.grid > .panel + .panel { margin-top: 0; }
.tile .v { margin-bottom: 0; }
.tile .s { font-size: 12px; color: var(--muted); margin-bottom: 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .bar { margin-top: 6px; }

/* ---- node access ---- */
.access-node .hostkey { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; padding: 8px 0 12px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.access-node .hostkey .muted { margin-right: 8px; }
table.logins td { vertical-align: middle; }
.sub-row td { padding-top: 0; }
.sub-row:hover { background: none; }
.err-text { overflow-wrap: anywhere; max-width: 360px; }
.keyline { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11.5px; margin-top: 8px; }
details.menu { display: inline-block; position: relative; }
details.menu > summary { list-style: none; cursor: pointer; }
details.menu > summary::-webkit-details-marker { display: none; }
details.menu[open] > summary { background: var(--panel-2); }
.menu-body {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 320px; text-align: left; white-space: normal;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.menu-body label { margin-top: 2px; }
.menu-body input, .menu-body select { margin-bottom: 8px; }
.menu-body hr { margin: 12px 0; }
.menu-body p { margin: 0 0 8px; }
label.check { display: flex; align-items: center; gap: 6px; font-weight: 400; margin: 4px 0 8px; }
label.check input { width: auto; margin: 0; }
details.add-login { margin-top: 12px; }
details.add-login > summary { cursor: pointer; color: var(--accent); font-weight: 550; }

/* ---- brand ---- */
:root { --side: #072124; --brand-ink: #072124; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --side: #051618; --brand-ink: #cfe8de; } }
:root[data-theme="dark"] { --side: #051618; --brand-ink: #cfe8de; }
.brand svg.logo { width: 30px; height: 30px; color: #d9efe6; }
.auth .brand svg.logo { color: var(--brand-ink); width: 34px; height: 34px; }

/* ---- avatars ---- */
img.avatar { object-fit: cover; background: var(--panel-2); }
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
.avatar-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.avatar-row input[type=file] { width: auto; }
.who-cell { display: flex; align-items: center; gap: 10px; }

/* ---- chat: files, deleting, vault links ---- */
.msg-main { min-width: 0; }
.msg-del { visibility: hidden; margin-left: 8px; padding: 0 6px; font-size: 11.5px; font-weight: 500; border: 0; background: none; color: var(--faint); }
.msg-del:hover { color: var(--bad); background: none; }
.msg:hover .msg-del { visibility: visible; }
.msg.cont .meta { visibility: visible; height: auto; }
.msg.cont .meta b, .msg.cont .meta .ts { display: none; }
.msg.cont .meta { position: absolute; right: 18px; margin-top: -2px; }
.msg { position: relative; }
.atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
/* Link previews in the console's chat (linkpreview.js): a small card per link. */
.lpvs { display: flex; flex-direction: column; gap: 4px; margin-top: 5px; max-width: min(380px, 100%); }
.lpv { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 5px 9px 5px 5px; border: 1px solid var(--line); border-left: 3px solid var(--accent-2); border-radius: 6px; background: var(--panel); color: var(--text); text-decoration: none; }
.lpv:hover { border-color: var(--accent-2); text-decoration: none; }
.lpv-pic, .lpv-tile { flex: none; width: 46px; height: 46px; border-radius: 4px; object-fit: cover; background: var(--panel-2); }
.lpv-pic.shot { width: 88px; object-position: top; border: 1px solid var(--line); }
.lpv-tile { display: grid; place-items: center; font-size: 18px; font-weight: 600; color: var(--muted); }
.lpv-tile img { width: 28px; height: 28px; object-fit: contain; }
.lpv-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.lpv-title, .lpv-desc, .lpv-site { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lpv-title { font-size: 12.5px; font-weight: 600; }
.lpv-desc { font-size: 11.5px; color: var(--muted); }
.lpv-site { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--faint); }
.lpv-site img { width: 12px; height: 12px; flex: none; object-fit: contain; }
.cw-bubble .lpvs { margin-bottom: 2px; }
.att-img img { display: block; max-width: min(360px, 100%); max-height: 280px; border-radius: 8px; border: 1px solid var(--line); }
.att-file { display: inline-flex; gap: 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: var(--text); max-width: 100%; }
.att-file::before { content: ""; width: 14px; height: 17px; flex: none; border: 1.5px solid var(--muted); border-radius: 2px 6px 2px 2px; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.composer-tools { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.composer-tools .hint { margin-left: 4px; }
.pending-files { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 14px; padding: 2px 4px 2px 10px; font-size: 12.5px; max-width: 280px; }
.chip span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip-x { border: 0; background: none; padding: 0 6px; font-size: 15px; line-height: 1; color: var(--muted); }
.chat-main.dragging { outline: 2px dashed var(--accent); outline-offset: -6px; }
.vault-picker { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; background: var(--panel); }
.vault-results { display: flex; flex-direction: column; max-height: 200px; overflow-y: auto; margin: 6px 0; }
.vault-result { justify-content: space-between; border: 0; border-radius: 6px; background: none; font-weight: 450; }
.md a[href^="/vault/"] { display: inline-flex; align-items: center; gap: 5px; padding: 0 8px; border-radius: 10px; background: var(--accent-soft); font-weight: 550; text-decoration: none; }
.md a[href^="/vault/"]::before { content: ""; width: 10px; height: 10px; border: 2px solid currentColor; border-radius: 50%; box-shadow: 5px 0 0 -3px currentColor; margin-right: 4px; }

/* ---- API pages (api_*.html) ---- */
/* The API usage pages' period (api-period in partials.html). */
.period-pick, .period-days { display: inline-flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.filters .period-days input { min-width: 0; width: 9.5em; }
.period-bar { margin-bottom: 12px; }
.api-kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.api-kpis .kpi .v { font-size: 22px; }
.api-kpis .kpi .s { padding-bottom: 0; }
.tab-n { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--panel-2); border-radius: 9px; padding: 0 7px; line-height: 18px; }
.page-tabs a.on .tab-n { color: var(--accent); background: var(--accent-soft); }
.page-tabs .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.page-tabs .dot.up { background: var(--ok); }
.page-tabs .dot.down { background: var(--bad); }
table.price-grid td.num div { white-space: nowrap; line-height: 1.35; }
table.price-grid td.num small { color: var(--muted); font-size: 10.5px; }
table.price-grid td.na { background: var(--panel-2); }
table.price-grid td.own { box-shadow: inset 3px 0 0 var(--accent); }
.api-own-mark { box-shadow: inset 3px 0 0 var(--accent); padding-left: 7px; }
.cache-bar { display: inline-block; vertical-align: middle; width: 48px; height: 5px; border-radius: 3px; background: var(--panel-2); overflow: hidden; margin-right: 4px; }
.cache-bar i { display: block; height: 100%; background: var(--vram); }
/* The node page's History range buttons take their own full-width row on phones (the last one was cut off). */
@media (max-width: 560px) {
  .chart-head { flex-wrap: wrap; }
  .chart-head .seg { width: 100%; }
  .chart-head .seg button { flex: 1; padding: 5px 4px; }
}
@media (max-width: 560px) {
  .api-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .api-kpis .kpi { padding: 10px 12px 11px; }
  .api-kpis .kpi .v { font-size: 18px; }
}

/* ---- idle sign-out warning ---- */
.idle-toast { position: fixed; right: 16px; bottom: 16px; z-index: 50; display: flex; gap: 12px; align-items: center; max-width: 420px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }

/* ---- nodes list ---- */
.head input.node-filter { width: 240px; }
table.node-list td { vertical-align: middle; }
table.node-list tr.offline td:nth-child(n+3) { opacity: .5; }
table.node-list td:first-child { min-width: 150px; }
.w-bar { width: 14%; min-width: 110px; }
.w-gpu { width: 22%; min-width: 170px; }
.cell-bar { font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-bar .bar { height: 5px; margin-top: 3px; }
.gpu-cell { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; }
.gpu-cell + .gpu-cell { margin-top: 6px; }
/* A narrow list (next to the map, or on a phone): each node becomes a card. */
.nodes-list-col { container: nodelist / inline-size; min-width: 0; }
@container nodelist (max-width: 860px) {
  table.node-list thead { display: none; }
  table.node-list, table.node-list tbody { display: block; }
  table.node-list tr { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px 20px; padding: 12px 18px; border-bottom: 1px solid var(--line); }
  table.node-list tr:last-child { border-bottom: 0; }
  table.node-list td { display: block; border: 0; padding: 0 !important; text-align: left; min-width: 0; }
  table.node-list td:first-child { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
  table.node-list td.node-st { grid-column: 1 / -1; }
  table.node-list td.node-actions { grid-column: 1 / -1; }
  table.node-list td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-bottom: 2px; }
  table.node-list tr[hidden] { display: none; }
}

/* ---- node access: collapsible blocks, nothing clipped ---- */
details.access-node { padding: 0; }
details.access-node + details.access-node, details.access-node + .panel { margin-top: 10px; }
details.access-node > summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 13px 18px; border-radius: var(--radius);
}
details.access-node > summary::-webkit-details-marker { display: none; }
details.access-node > summary:hover { background: var(--panel-2); }
details.access-node > summary h2 { margin: 0; }
details.access-node[open] > summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.access-flags { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.chev { width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; flex: none; margin-right: 2px; }
details[open] > summary .chev { transform: rotate(45deg); }
.access-body { padding: 10px 18px 16px; }
.access-addr { margin-bottom: 4px; overflow-wrap: anywhere; }
.access-node .node-addrs { padding: 4px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.access-node .node-addrs-head { margin-bottom: 4px; }
.access-node .node-addrs td.mono { overflow-wrap: anywhere; }
.node-addr-add { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.node-addr-add input[name=addr] { flex: 2 1 220px; min-width: 0; }
.node-addr-add input[name=note] { flex: 1 1 140px; min-width: 0; }
.access-node .hostkey { padding-top: 4px; }
table.logins td, table.keys td { vertical-align: middle; }
table.keys td.mono { word-break: break-all; min-width: 180px; }
@media (max-width: 760px) {
  table.logins thead, table.keys thead { display: none; }
  table.logins, table.logins tbody, table.logins tr, table.logins td,
  table.keys, table.keys tbody, table.keys tr, table.keys td { display: block; width: 100%; }
  table.logins tr, table.keys tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  table.logins td, table.keys td { border: 0; padding: 3px 0; text-align: left; }
  .menu-body { width: min(320px, calc(100vw - 48px)); left: 0; right: auto; }
}

/* ---- presence ---- */
.top-right { margin-left: auto; display: flex; align-items: center; gap: 14px; flex: none; }
.who { display: flex; align-items: center; gap: 4px; padding-right: 12px; border-right: 1px solid var(--line); height: 28px; }
.who-av, .av-wrap { position: relative; display: inline-flex; flex: none; }
.who-av:hover { text-decoration: none; opacity: .85; }
.who-av .avatar { width: 26px; height: 26px; font-size: 11px; }
.pdot { position: absolute; right: -2px; bottom: -2px; width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--panel); background: var(--faint); }
.chat-side .pdot { border-color: var(--panel-2); }
.pdot.online { background: #2fb36d; }
.pdot.idle { background: #e0a030; }
.pdot.offline { background: var(--panel); box-shadow: inset 0 0 0 2px var(--faint); }
.plabel.online { color: var(--ok); }
.plabel.idle { color: var(--warn); }
.plabel.offline { color: var(--muted); }
.chat-side a .av-wrap { margin-right: 2px; }

/* ---- notifications ---- */
/* The header's round-cornered buttons: Messages, Notifications, Apps (Ilya,
   2026-10-01: same size, light grey, light lines). */
.hbtn { position: relative; display: grid; place-items: center; width: 40px; height: 40px; box-sizing: border-box; border-radius: 10px; color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); }
.hbtn svg { opacity: .85; }
.hbtn:hover, details[open] > .hbtn, details.menu[open] > summary.hbtn { background: var(--line); color: var(--text); text-decoration: none; }
.hbtn:hover svg, details[open] > .hbtn svg, .hbtn.on svg { opacity: 1; }
.hbtn.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.hbtn .count { position: absolute; top: -8px; right: -9px; margin: 0; box-sizing: border-box; min-width: 22px; height: 22px; line-height: 18px; font-size: 11.5px; padding: 0 5px; border: 2px solid var(--panel); }
.bell .count { background: var(--bad); }
.notif-menu .menu-body.notif-body { width: min(390px, calc(100vw - 24px)); padding: 0; top: calc(100% + 8px); overflow: hidden; }
.notif-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.notif-list { max-height: min(60vh, 460px); overflow-y: auto; }
.notif-list .empty { padding: 22px 0; }
.notif-all { display: block; text-align: center; padding: 9px; border-top: 1px solid var(--line); font-size: 12.5px; }
.notif-offer { padding: 10px 14px; background: var(--accent-soft); border-bottom: 1px solid var(--line); font-size: 12.5px; }
.push-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.push-row > span { flex: 1 1 180px; }
.push-row.on > span { color: var(--ok); font-weight: 550; }
.push-row.denied > span, .push-row.unsupported > span { color: var(--warn); }
.push-state { margin: 6px 0 8px; }
.notif-item { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 14px; color: var(--text); border-bottom: 1px solid var(--line); }
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--panel-2); text-decoration: none; }
.notif-item.unread { background: var(--accent-soft); }
.notif-item.unread .ni-title { font-weight: 650; }
.ni-main { display: flex; flex-direction: column; min-width: 0; }
.ni-title { overflow-wrap: anywhere; }
.ni-body { color: var(--muted); font-size: 12.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.ni-time { color: var(--faint); font-size: 11.5px; white-space: nowrap; padding-top: 2px; }
.ni-kind { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: #fff; background: var(--faint); }
.ni-kind::before { content: "•"; }
.k-dm.ni-kind { background: #6a5acd; } .k-dm.ni-kind::before { content: "@"; }
.k-channel.ni-kind { background: var(--accent-2); } .k-channel.ni-kind::before { content: "#"; }
.k-ticket.ni-kind { background: #3b82c4; } .k-ticket.ni-kind::before { content: "✓"; }
.k-node.ni-kind { background: var(--bad); } .k-node.ni-kind::before { content: "!"; }
.notif-cols { grid-template-columns: minmax(0, 1fr) 360px; }
@media (max-width: 1000px) { .notif-cols { grid-template-columns: minmax(0, 1fr); } }
.device-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
label.check.opt { align-items: flex-start; }
label.check.opt input { margin-top: 3px; }
label.check.opt .hint { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
#settings h3 { margin: 12px 0 6px; }
#settings h2 + h3 { margin-top: 4px; }

.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.toast { display: flex; gap: 8px; align-items: flex-start; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid var(--accent-2);
  border-radius: var(--radius); padding: 10px 8px 10px 12px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); animation: toast-in .2s ease-out; }
.toast.k-node { border-left-color: var(--bad); }
.toast.k-ticket { border-left-color: #3b82c4; }
.toast.k-dm { border-left-color: #6a5acd; }
.toast a { flex: 1; min-width: 0; color: var(--text); display: flex; flex-direction: column; }
.toast a:hover { text-decoration: none; }
.toast a span { color: var(--muted); font-size: 12.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.toast-x { border: 0; background: none; color: var(--faint); font-size: 16px; line-height: 1; padding: 0 4px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.offer-card { position: fixed; right: 16px; bottom: 16px; z-index: 61; width: min(360px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: 0 8px 24px rgba(0, 0, 0, .2); }
.offer-card span { color: var(--muted); font-size: 13px; }
.offer-card .actions { margin-top: 4px; }
@media (max-width: 860px) {
  .who { display: none; }
  .top-right { gap: 6px; }
  /* live.js sets top from the bell's position */
  .notif-menu .menu-body.notif-body { position: fixed; left: 8px; right: 8px; width: auto; }
}

/* ---- messages button (header) ---- */
.msg-btn:has(.count:not([hidden])) { color: var(--accent); }

/* ---- apps menu (header, apps.go) ---- */
.apps-menu .menu-body.apps-body { width: min(312px, calc(100vw - 24px)); padding: 0; top: calc(100% + 8px); overflow: visible; }
.apps-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 8px 10px 12px; }
.apps-item { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 4px 8px; border-radius: 10px; color: var(--text);
  font-size: 12.5px; text-align: center; outline: none; }
.apps-item b { font-weight: 550; }
a.apps-item:hover, .apps-item:focus-visible { background: var(--panel-2); text-decoration: none; }
.apps-item.soon { cursor: default; }
.apps-item.soon :is(.apps-tile, b) { opacity: .55; }
.apps-tip { position: absolute; top: calc(100% - 2px); left: 50%; z-index: 2; width: 190px; translate: -50% 0; padding: 7px 10px; border-radius: 8px;
  background: var(--text); color: var(--bg); font-size: 12px; line-height: 1.35; text-align: left; box-shadow: 0 6px 18px rgba(0, 0, 0, .18);
  opacity: 0; visibility: hidden; transition: opacity .12s, visibility 0s .12s; pointer-events: none; }
.apps-item:nth-child(3n+1) .apps-tip { left: 0; translate: 0 0; }
.apps-item:nth-child(3n) .apps-tip { left: auto; right: 0; translate: 0 0; }
.apps-item:is(:hover, :focus-visible) .apps-tip { opacity: 1; visibility: visible; transition-delay: .25s, .25s; }
.apps-tip .apps-where { display: block; margin-top: 3px; font-size: 11px; opacity: .7; }
.apps-tile { flex: none; display: grid; place-items: center; width: 46px; height: 46px; border-radius: 12px;
  color: hsl(var(--h) 45% 32%); background: hsl(var(--h) 55% 92%); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .apps-tile { color: hsl(var(--h) 55% 78%); background: hsl(var(--h) 25% 20%); } }
:root[data-theme="dark"] .apps-tile { color: hsl(var(--h) 55% 78%); background: hsl(var(--h) 25% 20%); }
@media (max-width: 860px) {
  .apps-menu .menu-body.apps-body { position: fixed; left: auto; right: 8px; } /* top: app.js */
}

/* ---- files: picker, cards, My files ---- */
.file-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.file-pick .btn { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.file-pick .hint { font-size: 12px; color: var(--muted); }
.file-pick .pending-files { flex: 1 1 100%; margin: 2px 0 0; }
form.dragging { outline: 2px dashed var(--accent); outline-offset: 6px; border-radius: 6px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
/* No overflow: hidden on the card: its "…" menu must be able to stick out. */
.fcard { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); min-width: 0; }
.fthumb { display: block; aspect-ratio: 4 / 3; background: var(--panel-2); overflow: hidden; border-radius: calc(var(--radius) - 1px) calc(var(--radius) - 1px) 0 0; }
.fbtns .menu-body { width: 270px; left: 0; right: auto; }
.fthumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ficon { display: grid; place-items: center; text-decoration: none !important; }
.ficon span { font: 700 13px/1 var(--mono); letter-spacing: .04em; color: var(--muted); border: 2px solid var(--faint); border-radius: 4px 12px 4px 4px; padding: 14px 8px; min-width: 52px; text-align: center; background: var(--panel); }
.fmeta { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px 4px; min-width: 0; }
.fname { color: var(--text); font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fbtns { display: flex; gap: 12px; align-items: center; padding: 2px 10px 9px; margin-top: auto; flex-wrap: wrap; }
.danger-link { color: var(--bad) !important; }
button.saved { color: var(--ok) !important; }
.comment-files { padding: 0 12px 12px; }
.comment-files .file-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.my-files { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.fcard.big .fbtns { padding-top: 6px; }

/* Photos sorted by date or resolution and shown as a grid or a list
   (HG.photoSet in app.js): search's Photos tab, My files, tickets and
   milestones, a conversation's Shared menu. */
.photo-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 12px; }
.sort-pick { position: relative; display: inline-flex; align-items: center; color: var(--muted); }
.sort-pick > svg { position: absolute; left: 11px; pointer-events: none; }
.sort-pick::after { content: ""; position: absolute; right: 13px; top: 50%; width: 6px; height: 6px; border: solid currentColor; border-width: 0 1.7px 1.7px 0; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.sort-pick select {
  -webkit-appearance: none; appearance: none; width: auto; min-width: 0; height: 32px; margin: 0; padding: 0 34px 0 33px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text);
  font: inherit; font-size: 13px; font-weight: 550; line-height: 30px; cursor: pointer;
}
.sort-pick select:hover { background: var(--panel-2); }
.sort-pick select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.view-pick { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); }
.view-pick button { display: grid; place-items: center; width: 32px; height: 26px; margin: 0; padding: 0; border: 0; border-radius: 999px; background: none; color: var(--muted); cursor: pointer; }
.view-pick button:hover { color: var(--text); }
.view-pick button.on { background: var(--accent-soft); color: var(--text); }
.view-pick button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.shared-list .photo-tools { margin: 4px 2px 12px; }
.lv-only { display: none; }
[data-view="list"] .lv-only { display: inline; }
.file-grid[data-view="list"], .my-files[data-view="list"] { grid-template-columns: minmax(0, 1fr); gap: 0; }
.file-grid[data-view="list"] .fcard, .my-files[data-view="list"] .fcard { flex-direction: row; align-items: center; gap: 12px; padding: 8px 0; border-width: 0 0 1px; border-radius: 0; background: none; }
.file-grid[data-view="list"] .fcard:last-child, .my-files[data-view="list"] .fcard:last-child { border-bottom: 0; }
.file-grid[data-view="list"] .fthumb, .my-files[data-view="list"] .fthumb { width: 72px; flex: none; aspect-ratio: 1; border-radius: 6px; }
.file-grid[data-view="list"] .ficon span, .my-files[data-view="list"] .ficon span { padding: 8px 4px; min-width: 40px; font-size: 11px; }
.file-grid[data-view="list"] .fmeta, .my-files[data-view="list"] .fmeta { flex: 1; padding: 0; }
.file-grid[data-view="list"] .fbtns, .my-files[data-view="list"] .fbtns { flex: none; margin: 0; padding: 0; }
@media (max-width: 560px) {
  .file-grid[data-view="list"] .fcard, .my-files[data-view="list"] .fcard { flex-wrap: wrap; }
  .file-grid[data-view="list"] .fbtns, .my-files[data-view="list"] .fbtns { flex-basis: 100%; padding-left: 84px; }
}
.search-hits[data-view="grid"] { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; padding: 12px; }
.search-hits[data-view="grid"] .search-hit, .search-hits[data-view="grid"] .sh-link { display: flex; flex-direction: column; align-items: stretch; gap: 6px; padding: 0; border-top: 0; min-width: 0; }
.search-hits[data-view="grid"] .sh-photo { width: 100%; height: auto; aspect-ratio: 1; }
.search-hits[data-view="grid"] .sh-text, .search-hits[data-view="grid"] .sh-file { display: none; }
.search-hits[data-view="grid"] .sh-meta { font-size: 12px; }
.shared-photos[data-view="list"] { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.shared-photos[data-view="list"] figure { display: flex; gap: 10px; align-items: center; }
.shared-photos[data-view="list"] img { width: 56px; flex: none; }
.shared-photos[data-view="list"] figcaption { margin: 0; min-width: 0; font-size: 12px; }
.sp-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-panel p { margin: 10px 0 0; }
/* My files: dragging files over the page (app.js, data-drop-page). */
.drop-page { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 24px; background: color-mix(in srgb, var(--bg) 78%, transparent); backdrop-filter: blur(2px); pointer-events: none; }
.drop-page > div { display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(520px, 100%); padding: 48px 24px; border: 2px dashed var(--accent); border-radius: 16px; background: var(--panel); text-align: center; box-shadow: 0 12px 40px rgba(0, 0, 0, .18); }
.drop-page b { font-size: 18px; }
.drop-page span { color: var(--muted); font-size: 13px; }
.upload-panel form { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.upload-panel .file-pick { flex: 1 1 320px; }

/* ticket side panel */
.side-file { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.side-file:first-of-type { border-top: 0; }
.sf-thumb { width: 38px; height: 38px; border-radius: 6px; overflow: hidden; background: var(--panel-2); display: grid; place-items: center; flex: none; }
.sf-thumb img { width: 100%; height: 100%; object-fit: cover; }
.sf-thumb.ficon span { font-size: 9px; padding: 4px 3px; min-width: 0; border-width: 1.5px; border-radius: 2px 6px 2px 2px; }
.sf-main { display: flex; flex-direction: column; min-width: 0; }
.sf-main a { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.side-files form { margin-top: 10px; border-top: 1px solid var(--line); padding-top: 10px; }

/* chat attachments: save button */
.atts { align-items: flex-start; }
.att { position: relative; display: inline-flex; max-width: 100%; }
.att-save { position: absolute; top: 6px; right: 6px; padding: 2px 9px; font-size: 11.5px; font-weight: 600; border: 0; border-radius: 10px;
  background: rgba(10, 16, 18, .72); color: #fff; opacity: 0; transition: opacity .12s; }
.att:hover .att-save, .att-save:focus-visible, .att-save.saved { opacity: 1; }
.att-save.saved { background: var(--ok); color: #fff !important; }
.att .att-file { padding-right: 64px; }
.att-file .srch-mark { position: static; width: 18px; height: 18px; flex: none; margin-left: -4px; }
.att-file.gone { color: var(--muted); }
.att-file.gone::before { border-style: dashed; }
.att:has(.att-transcript) { flex-direction: column; align-items: flex-start; gap: 4px; }
.att-transcript { font-size: 12.5px; font-weight: 600; padding: 0 4px; }
.call-line .call-transcript { font-weight: 600; font-size: 13px; }
.msg.mine .att:has(.att-transcript) { align-items: flex-end; }
.rec-player { display: block; width: 100%; max-width: 720px; margin: 0 0 14px; }
video.rec-player { max-height: 60vh; background: #000; border-radius: 8px; }
.rec-summary { font-size: 14px; }
.transcript .turn { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 10px; padding: 6px 0; border-top: 1px solid var(--line); scroll-margin-top: 90px; }
.transcript .turn:first-of-type { border-top: 0; }
.transcript .turn:target { background: var(--accent-soft, var(--panel-2)); border-radius: 6px; }
.turn-time { color: var(--muted); padding-top: 2px; }
.turn-body { overflow-wrap: anywhere; }
.turn-who { color: var(--accent); font-weight: 600; margin-right: 4px; }
.sh-file { display: flex; gap: 6px; align-items: baseline; margin: 2px 0; font-weight: 600; overflow-wrap: anywhere; }
.doc-kind { font: 600 10.5px/1.4 var(--mono, ui-monospace, monospace); padding: 0 5px; border-radius: 4px; background: var(--panel-2); color: var(--muted); flex: none; }
@media (hover: none) { .att-save { opacity: 1; } }

/* chat: shared photos, files and links */
.chat-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shared-menu > summary { display: inline-flex; align-items: center; gap: 5px; }
.shared-menu .menu-body.shared-body { left: 0; right: auto; width: min(480px, calc(100vw - 32px)); padding: 10px; }
.shared-tabs { display: flex; margin-bottom: 8px; }
.shared-tabs button { flex: 1; border: 0; border-radius: 0; background: none; padding: 6px 8px; font-weight: 550; color: var(--muted); }
.shared-tabs button.on { color: var(--text); background: var(--accent-soft); }
.shared-tabs button span { color: var(--faint); font-weight: 400; margin-left: 2px; }
.shared-list { max-height: min(62vh, 520px); overflow-y: auto; }
.shared-photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.shared-photos figure { margin: 0; min-width: 0; }
.shared-photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; display: block; background: var(--panel-2); }
.shared-photos figcaption { display: flex; flex-direction: column; font-size: 11px; margin-top: 3px; line-height: 1.35; }
.shared-photos figcaption .link { font-size: 11px; margin-right: 8px; }
.shared-row { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; padding: 8px 2px; border-top: 1px solid var(--line); }
.shared-row:first-child { border-top: 0; }
.sr-main { display: flex; flex-direction: column; min-width: 0; }
.sr-main > a { display: flex; flex-direction: column; min-width: 0; color: var(--text); overflow-wrap: anywhere; }
.sr-url { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sr-btns { display: flex; gap: 12px; }
.link-ico { font-size: 17px; color: var(--accent); }
.msg.hl { animation: msg-hl 2.4s ease-out; border-radius: 6px; }
@keyframes msg-hl { 0%, 30% { background: var(--accent-soft); box-shadow: 0 0 0 6px var(--accent-soft); } 100% { background: transparent; box-shadow: 0 0 0 6px transparent; } }
.newer-note { display: block; text-align: center; padding: 6px; background: var(--accent-soft); font-weight: 550; font-size: 12.5px; border-top: 1px solid var(--line); }
.newer-link { font-weight: 550; }
.push-hint { color: var(--warn); margin: 8px 0 0; }

/* ---- chat: the list scrolls inside the box; the message box always stays in view ---- */
.chat { grid-template-rows: minmax(0, 1fr); }
.chat-main, .msgs { min-height: 0; }
@media (max-width: 860px) { .chat { grid-template-rows: auto; } }

/* ---- chat: bubbles; your own messages on the right ---- */
.msg-main { display: flex; flex-direction: column; align-items: flex-start; }
.msg .md { display: inline-block; max-width: min(720px, 100%); margin-top: 2px; padding: 7px 12px; background: var(--panel-2); border-radius: 4px 14px 14px 14px; overflow-wrap: anywhere; }
.msg.cont .md { border-radius: 14px; }
.msg .md pre { background: var(--panel); }
.msg .md code { background: rgba(127, 127, 127, .16); }
.msg.mine { grid-template-columns: minmax(0, 1fr); }
.msg.mine > .avatar { display: none; }
.msg.mine .msg-main { position: relative; justify-self: end; align-items: flex-end; max-width: min(720px, 88%); }
.msg.mine .md { background: var(--accent-soft); border-radius: 14px 4px 14px 14px; text-align: left; }
.msg.mine.cont .md { border-radius: 14px; }
.msg.mine .md a[href^="/vault/"] { background: var(--panel); }
.msg.mine .meta b { display: none; }
.msg.mine .msg-del { margin-left: 6px; }
.msg.mine .atts { justify-content: flex-end; }
/* on follow-up messages only the Delete button shows, left of the bubble */
.msg.mine.cont .meta { right: calc(100% + 2px); top: 50%; transform: translateY(-50%); margin: 0; }
/* someone else's follow-up messages: the buttons right after the bubble, not
   at the far edge of the row (Ilya, 2026-10-01) */
.msg.cont:not(.mine) .msg-main { position: relative; justify-self: start; max-width: min(720px, calc(100% - 128px)); }
.msg.cont:not(.mine) .meta { right: auto; left: calc(100% + 4px); top: 50%; transform: translateY(-50%); margin: 0; }

/* ---- photo overlay ---- */
html.lb-open { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(5, 10, 12, .92); display: flex; flex-direction: column; color: #e9eef0; }
.lightbox[hidden] { display: none !important; }
.lb-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 14px; flex-wrap: wrap; }
.lb-title { display: flex; flex-direction: column; min-width: 0; }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-caption, .lb-count { font-size: 12.5px; color: #9fb0b5; }
.lb-caption:not(:empty) + .lb-count:not(:empty)::before { content: " · "; }
.lb-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.lb-btn { background: rgba(255, 255, 255, .1); color: #fff; border: 0; border-radius: 7px; padding: 6px 11px; font-size: 13px; font-weight: 550; cursor: pointer; }
.lb-btn:hover { background: rgba(255, 255, 255, .2); text-decoration: none; }
.lb-btn.saved { background: var(--ok); }
.lb-close { font-size: 20px; line-height: 1; padding: 4px 11px 6px; }
.lb-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 0 8px 16px; }
.lb-stage img { max-width: calc(100% - 110px); max-height: 100%; object-fit: contain; border-radius: 4px; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); background: #111; }
.lb-nav { flex: none; width: 46px; height: 64px; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); color: #fff; font-size: 34px; line-height: 1; cursor: pointer; }
.lb-nav:hover { background: rgba(255, 255, 255, .18); }
@media (max-width: 700px) {
  .lb-stage { position: relative; padding: 0 0 12px; }
  .lb-stage img { max-width: 100%; }
  .lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 38px; height: 54px; background: rgba(0, 0, 0, .45); z-index: 1; }
  .lb-prev { left: 6px; } .lb-next { right: 6px; }
}

/* ---- tabs inside a page (node page) ---- */
.page-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin: -4px 0 18px; overflow-x: auto; }
.page-tabs a { padding: 9px 14px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.page-tabs a:hover { color: var(--text); text-decoration: none; }
.page-tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.access-overview td { vertical-align: middle; }

/* ---- nodes page: list + map ---- */
.nodes-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(340px, 44%); gap: 16px; align-items: start; }
.nodes-map-col { position: sticky; top: calc(var(--top) + 16px); }
.map-panel { padding: 0; overflow: hidden; }
.world-map { height: calc(100vh - var(--top) - 150px); min-height: 340px; }
.map-foot { padding: 9px 14px; border-top: 1px solid var(--line); }
.map-foot a { font-weight: 550; }
@media (max-width: 1100px) {
  .nodes-layout { grid-template-columns: minmax(0, 1fr); }
  .nodes-map-col { position: static; order: -1; }
  .world-map { height: 340px; min-height: 0; }
}
.node-place { font-size: 12px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.pin { width: 9px; height: 9px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); background: var(--accent); display: inline-block; margin: 0 2px; }
table.node-list tr.map-hl, table.node-list tr.map-hl:hover { background: var(--accent-soft); }

/* ---- map ---- */
:root { --map-sea: #dfe9ec; --map-land: #f8faf9; --map-border: #b9c6c9; --map-road-a: #e2a15a; --map-road-b: #e4c795; --map-road-c: #e6d4b4; --map-place: #3a4648; --map-place-dot: #66767a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --map-sea: #0d1719; --map-land: #1d2a2c; --map-border: #34474a; --map-road-a: #a36f3b; --map-road-b: #6f6448; --map-road-c: #4a4a3e; --map-place: #cdd8d9; --map-place-dot: #95a6a9; } }
:root[data-theme="dark"] { --map-sea: #0d1719; --map-land: #1d2a2c; --map-border: #34474a; --map-road-a: #a36f3b; --map-road-b: #6f6448; --map-road-c: #4a4a3e; --map-place: #cdd8d9; --map-place-dot: #95a6a9; }
.map { position: relative; overflow: hidden; background: var(--map-sea); touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.map.dragging { cursor: grabbing; }
.map-svg { width: 100%; height: 100%; display: block; }
.map-sea { fill: var(--map-sea); }
.map-land path { fill: var(--map-land); stroke: var(--map-border); stroke-width: .7; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.map-roads, .map-places { pointer-events: none; }
.map-roads path { fill: none; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.map-roads .rd-a { stroke: var(--map-road-a); stroke-width: 2.2; }
.map-roads .rd-b { stroke: var(--map-road-b); stroke-width: 1.5; }
.map-roads .rd-c { stroke: var(--map-road-c); stroke-width: 1; }
.map-places circle { fill: var(--map-place-dot); stroke: var(--map-land); stroke-width: 1.2; }
.map-places text { font: 500 11px system-ui, -apple-system, "Segoe UI", sans-serif; fill: var(--map-place); paint-order: stroke; stroke: var(--map-land); stroke-width: 3px; stroke-linejoin: round; }
.map-places .cap text { font-weight: 650; }
.map-places .cap circle { fill: var(--map-land); stroke: var(--map-place); stroke-width: 1.6; }
.map-mk { cursor: pointer; }
.map-mk .halo { fill: transparent; }
.map-mk .dot { fill: var(--faint); stroke: #fff; stroke-width: 2; }
.map-mk.up .dot { fill: #2fb36d; }
.map-mk.down .dot { fill: var(--bad); }
.map-mk.pick .dot { fill: var(--accent); }
.map-mk.hl .halo { fill: rgba(47, 179, 109, .22); stroke: #2fb36d; stroke-width: 1.5; }
.map-mk.hl .dot { r: 8; }
.map-mk .lbl { font: 600 12px system-ui, -apple-system, "Segoe UI", sans-serif; fill: var(--text); paint-order: stroke; stroke: var(--map-land); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.map-mk.off { display: none; }
.map-ctrls { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 4px; }
.map-btn { width: 30px; height: 30px; padding: 0; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--line); background: var(--panel); color: var(--text); box-shadow: var(--shadow); }
.map-btn svg { display: block; }
/* Bigger map: the window. */
.map.map-full { position: fixed; inset: 0; z-index: 45; width: auto; height: auto; min-height: 0; border-radius: 0; border: 0; }
body.map-full-open { overflow: hidden; }
body.map-full-open .nodes-map-col { position: static; } /* sticky would keep it under the header */
.map-btn:hover { background: var(--panel-2); }
.map-credit { position: absolute; right: 4px; bottom: 3px; font-size: 9.5px; line-height: 1; color: var(--muted); opacity: .75; pointer-events: none; }
.map-tip { position: absolute; z-index: 2; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; font-size: 12px; box-shadow: 0 4px 14px rgba(0, 0, 0, .15); max-width: 220px; }

/* ---- host card ---- */
.card-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px 24px; }
.card-groups h3 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 0 0 6px; }
.pre-line { white-space: pre-line; }
.mini-map { height: 230px; border-radius: 6px; }
.pick-map { height: 360px; border-radius: 6px; border: 1px solid var(--line); cursor: crosshair; }
.pick-map.dragging { cursor: grabbing; }
details.card-edit > summary { cursor: pointer; color: var(--accent); font-weight: 600; }
details.card-edit h3 { font-size: 13px; margin-bottom: 8px; }

/* ---- calls (the call window itself: call.css) ---- */
.call-btns { display: flex; gap: 6px; margin-left: auto; }
.call-btns button { display: inline-flex; align-items: center; gap: 5px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #2fb36d; box-shadow: 0 0 0 3px rgba(47, 179, 109, .22); flex: none; animation: live-pulse 1.6s ease-in-out infinite; }
@keyframes live-pulse { 50% { box-shadow: 0 0 0 6px rgba(47, 179, 109, .08); } }
@media (prefers-reduced-motion: reduce) { .live-dot { animation: none; } }
.call-banner { display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 7px 10px 7px 12px; border-radius: 8px; background: var(--accent-soft); font-size: 13px; }
.call-banner button { margin-left: auto; }
.msg.call-msg { display: block; }
.call-line { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; margin: 4px auto; width: fit-content; max-width: 100%; padding: 6px 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); font-size: 13px; }
.call-line .call-ico { display: inline-flex; color: var(--muted); }
.call-line.live { border-color: var(--accent-2); background: var(--accent-soft); }
.call-line.live .call-ico { color: var(--accent); }
.call-line button { padding: 2px 12px; }
.call-pill { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--accent-soft); border-color: var(--accent-2); color: var(--accent); max-width: 240px; }
.call-pill span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ring-box { position: fixed; top: 16px; right: 16px; z-index: 80; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); }
.ring-card { background: var(--panel); border: 1px solid var(--accent-2); border-radius: 12px; padding: 14px; box-shadow: 0 12px 32px rgba(0, 0, 0, .25); animation: ring-in .2s ease-out; }
@keyframes ring-in { from { transform: translateY(-8px); opacity: 0; } }
.ring-top { display: flex; align-items: center; gap: 12px; }
.ring-av { width: 42px; height: 42px; font-size: 15px; }
.ring-main { display: flex; flex-direction: column; min-width: 0; }
.ring-actions { display: flex; gap: 8px; margin-top: 12px; }
.ring-actions button { flex: 1; }
.ring-actions .ring-no { color: #fff; background: var(--bad); border-color: var(--bad); }
.k-call.ni-kind { background: #d0612e; } .k-call.ni-kind::before { content: "☎"; }
.toast.k-call { border-left-color: #d0612e; }
@media (max-width: 860px) {
  .call-btns button { padding: 4px 8px; }
  .call-pill { max-width: 150px; }
}

/* ---- chat: replies, read statuses, emoji ---- */
.msg-act { visibility: hidden; margin-left: 8px; padding: 0 6px; font-size: 11.5px; font-weight: 500; border: 0; background: none; color: var(--faint); }
.msg-act:hover { color: var(--accent); background: none; }
.msg:hover .msg-act, .msg.show-act .msg-act, .msg.show-act .msg-del { visibility: visible; }
.msg.mine .msg-act { margin-left: 6px; }
.reply-quote { display: flex; flex-direction: column; max-width: min(520px, 100%); margin: 3px 0 1px; padding: 3px 10px; border-left: 3px solid var(--accent-2); border-radius: 4px; background: rgba(127, 127, 127, .09); color: var(--muted); font-size: 12.5px; line-height: 1.4; text-decoration: none; }
.reply-quote:hover { background: rgba(127, 127, 127, .16); text-decoration: none; }
.reply-quote b { color: var(--text); font-weight: 600; }
.reply-quote span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.reply-quote.gone { border-left-color: var(--line); font-style: italic; cursor: default; }
.msg.mine .reply-quote { align-self: flex-end; }
.reply-bar { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; padding: 5px 6px 5px 10px; border-left: 3px solid var(--accent-2); border-radius: 6px; background: var(--panel-2); font-size: 12.5px; }
.reply-bar .rb-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.reply-bar .rb-main span { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.read-status { margin-top: 2px; font-size: 11.5px; color: var(--faint); }
.read-status.seen { color: var(--accent); }
.read-marks { grid-column: 1 / -1; justify-self: end; display: flex; gap: 3px; margin-top: 2px; }
.read-marks .avatar { width: 16px; height: 16px; font-size: 7.5px; }
.msg .md.jumbo { background: none; padding: 0; font-size: 40px; line-height: 1.2; }

/* ---- code boxes (codeblock.go; colours in code.css) ---- */
.code-box { margin: 4px 0 8px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--panel); max-width: 100%; }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 3px 6px 3px 10px; border-bottom: 1px solid var(--line); background: var(--panel-2); font-size: 11.5px; }
.code-lang { color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.code-copy { padding: 1px 9px; font-size: 11.5px; font-weight: 500; }
.code-copy.copied { color: var(--accent); border-color: var(--accent-2); }
.code-box pre.chroma { margin: 0; padding: 9px 12px; overflow-x: auto; background: none; font: 12.5px/1.5 var(--mono); tab-size: 4; }
.md .code-box pre code, .msg .md .code-box code { background: none; padding: 0; white-space: pre; }
.msg .md:has(.code-box) { display: block; width: min(720px, 100%); }
.msg .md .code-box { background: var(--panel); }

/* ---- emoji ---- */
.composer .grow { position: relative; }
.emoji-btn { font-size: 15px; line-height: 1; padding: 3px 8px; }
.emoji-panel { position: absolute; bottom: calc(100% + 8px); left: 0; z-index: 30; width: min(360px, calc(100vw - 32px)); display: flex; flex-direction: column; gap: 6px; padding: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .2); }
.emoji-cats { display: flex; gap: 2px; }
.emoji-cat { flex: 1; padding: 4px 0; border: 0; background: none; font-size: 17px; line-height: 1; border-radius: 6px; }
.emoji-cat:hover { background: var(--panel-2); }
.emoji-grid { height: 260px; overflow-y: auto; }
.emoji-grid h4 { position: sticky; top: 0; margin: 0; padding: 4px 2px; background: var(--panel); font-size: 11.5px; font-weight: 600; color: var(--muted); }
.emoji-set { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); }
.emoji-cell { padding: 0; height: 34px; border: 0; background: none; font-size: 21px; line-height: 1; border-radius: 6px; }
.emoji-cell:hover, .emoji-cell:focus-visible { background: var(--panel-2); }
.emoji-suggest { position: absolute; bottom: calc(100% + 6px); left: 0; z-index: 30; display: flex; flex-direction: column; min-width: 240px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); }
.sugg { display: flex; align-items: center; gap: 10px; justify-content: flex-start; padding: 4px 8px; border: 0; background: none; font-weight: 450; font-size: 13px; border-radius: 6px; }
.sugg.on, .sugg:hover { background: var(--accent-soft); }
.sugg-e { font-size: 18px; width: 22px; text-align: center; }
@media (hover: none) { .msg-act, .msg-del { padding: 2px 8px; } }

/* ---- chat: editing ---- */
.edited-tag { font-size: 11px; color: var(--faint); margin: 1px 4px 0; }
.msg.editing .md { outline: 2px solid var(--accent-2); outline-offset: 1px; }
.edit-bar { border-left-color: var(--warn); }

/* ---- private groups ---- */
.ch-mark { display: inline-flex; align-items: center; justify-content: center; width: 13px; color: var(--muted); flex: none; }
.chat-head h1 { display: inline-flex; align-items: center; gap: 6px; }
.chat-side .new-channel .pick-people { display: none; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px 2px; margin: 0 0 8px; max-height: 180px; overflow-y: auto; }
.chat-side .new-channel form:has([name=private]:checked) .pick-people { display: block; }
.pick-people legend { font-size: 11.5px; color: var(--muted); padding: 0 4px; }
.pick-people label.check { margin: 3px 0; }
.members-menu > summary { display: inline-flex; align-items: center; gap: 5px; }
.leave-group { margin: 0; }
.chat-more { margin-left: auto; }
.chat-more > summary { display: inline-flex; align-items: center; padding: 6px 8px; }
.chat-more .menu-body { width: min(290px, calc(100vw - 32px)); }
.chat-more form { margin: 0; }
.chat-more button.danger { display: inline-flex; align-items: center; gap: 6px; }
.chat-more .hint { margin: 8px 0 0; }
.leave-group button { display: inline-flex; align-items: center; gap: 5px; }
.members-menu .menu-body.members-body { left: 0; right: auto; width: min(320px, calc(100vw - 32px)); }
.member-list { list-style: none; margin: 0 0 10px; padding: 0; max-height: 260px; overflow-y: auto; }
.member-list li { display: flex; align-items: center; gap: 8px; padding: 4px 0; }
.member-list .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.member-list form { margin: 0; }
.member-add { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.member-add select { flex: 1; margin: 0; }
.members-body .hint { font-size: 12px; color: var(--muted); margin: 8px 0 0; }

/* ---- users page: access ---- */
.access-fields .module-list { padding-left: 22px; margin: -2px 0 6px; }
.access-fields .module-list label.check { margin: 2px 0 6px; }
.role-list { max-width: 260px; white-space: normal; margin-top: 3px; }
/* Phones: one card per person (the table can't scroll sideways: its menus must stick out). */
@media (max-width: 760px) {
  table.users thead { display: none; }
  table.users, table.users tbody, table.users tr, table.users td { display: block; width: 100%; }
  table.users tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  table.users td { border: 0; padding: 3px 0; text-align: left; white-space: normal; overflow-wrap: anywhere; }
  table.users td.right { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 6px; }
  table.users .role-list { max-width: none; }
}
.table-wrap.has-menus { overflow: visible; } /* the Access… menus open below the row */

/* ---- My links ---- */
.link-add { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 8px; }
.link-add input[name=url] { flex: 2 1 260px; margin: 0; }
.link-add input[name=title] { flex: 1 1 180px; margin: 0; }
.link-list { padding: 0; }
.link-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.link-row:last-child { border-bottom: 0; }
.link-ico { flex: none; width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); font-weight: 700; position: relative; }
.link-ico .srch-mark { left: auto; right: -5px; bottom: -5px; width: 16px; height: 16px; }
.link-seen { margin-top: 4px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; cursor: pointer; }
.link-seen.open { display: block; }
.link-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.link-title { font-weight: 600; overflow-wrap: anywhere; }
.link-url { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link-row .menu-body { right: 0; left: auto; }

/* ---- reactions ---- */
.reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.msg.mine .reacts { justify-content: flex-end; }
.react { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; min-height: 24px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); color: var(--text); font-size: 14px; line-height: 1; cursor: pointer; }
.react span { font-size: 12px; font-weight: 600; color: var(--muted); }
.react:hover { border-color: var(--faint); }
.react.mine { border-color: var(--accent); background: var(--accent-soft); }
.react.mine span { color: var(--text); }
.react-bar { position: absolute; z-index: 30; display: flex; gap: 2px; padding: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.react-bar[hidden] { display: none; }
.react-bar button { width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: none; font-size: 19px; line-height: 1; cursor: pointer; }
.react-bar button:hover { background: var(--panel-2); transform: scale(1.12); }
.react-bar .rb-more { font-size: 18px; color: var(--muted); }
.emoji-panel.for-react { outline: 2px solid var(--accent); }
.link-pick { position: absolute; z-index: 30; width: min(380px, calc(100vw - 16px)); padding: 6px 10px 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .18); }
.link-pick[hidden] { display: none; }
.link-pick .lp-row { display: flex; gap: 10px; align-items: center; padding: 5px 0; border-top: 1px solid var(--line); }
.link-pick .lp-head { padding: 2px 0 6px; }
.link-pick .lp-url { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

/* ---- chat: action icons, your times on the right, search ---- */
.msg .meta { display: flex; align-items: center; gap: 6px; min-height: 22px; }
.msg .meta b { margin-right: 0; }
.msg .meta .acts { display: inline-flex; align-items: center; gap: 1px; }
.msg-act, .msg-del { display: inline-grid; place-items: center; width: 24px; height: 22px; margin: 0; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--faint); cursor: pointer; }
.msg .meta .msg-act:hover { background: var(--panel-2); color: var(--accent); }
.msg .meta .msg-del:hover { background: var(--panel-2); color: var(--bad); }
.msg-act.saved { visibility: visible; color: var(--ok); }
.msg.mine .meta { flex-direction: row-reverse; } /* the time at the right edge, the icons left of it */
.msg.mine .msg-act, .msg.mine .msg-del { margin-left: 0; }
@media (hover: none) { .msg-act, .msg-del { width: 30px; height: 28px; padding: 0; } }

.chat-search { display: flex; align-items: center; gap: 6px; margin: 0 4px 8px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); color: var(--faint); }
.chat-search:focus-within { border-color: var(--accent); }
.chat-search input { flex: 1; min-width: 0; margin: 0; padding: 7px 0; border: 0; background: none; box-shadow: none; outline: none; font-size: 13px; }
.chat-main.searching .msgs { display: none; }
.search-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.search-panel[hidden] { display: none; }
.sp-head { display: flex; align-items: center; gap: 10px; padding: 8px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sp-head .seg button { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-head .chip-x { margin-left: auto; }
.sp-list { flex: 1; min-height: 0; overflow-y: auto; padding: 4px 10px 12px; }
.sp-hit { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); text-decoration: none; }
.sp-hit:hover { background: var(--panel-2); text-decoration: none; }
.sp-hit + .sp-hit { border-top: 1px solid var(--line); }
.sp-meta { display: flex; gap: 8px; align-items: baseline; font-size: 12px; color: var(--muted); }
.sp-meta b { color: var(--text); font-weight: 600; }
.sp-text { margin-top: 2px; font-size: 13.5px; line-height: 1.45; overflow-wrap: anywhere; white-space: pre-line; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.sp-text mark { background: rgba(240, 190, 60, .35); color: inherit; border-radius: 2px; padding: 0 1px; }
.sp-more { display: block; margin: 10px auto 0; }

/* ---- "Add to vault" on selected text ---- */
.vq-btn { position: absolute; z-index: 75; display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; font-size: 12px; font-weight: 600; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--text); box-shadow: 0 4px 14px rgba(0, 0, 0, .2); cursor: pointer; }
.vq-btn:hover { border-color: var(--accent); color: var(--accent); }
.vq-btn[hidden], .vq-pop[hidden], .vq-pop [hidden] { display: none; }
.vq-pop { position: absolute; z-index: 76; width: min(300px, calc(100vw - 16px)); display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .22); }
.vq-head { display: flex; align-items: center; justify-content: space-between; }
.vq-pop input { margin: 0; }
.vq-kind { align-self: flex-start; }
.vq-preview { overflow-wrap: anywhere; }
.vq-preview:empty { display: none; }
.vq-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.vq-msg.bad, .vq-pop .link.danger { color: var(--bad); }

/* ---- Slack ---- */
.slack-side { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.slack-chip svg { margin-right: 4px; }
.slack-menu .menu-body { width: min(340px, 86vw); }
.slack-mirrors { list-style: none; margin: 0 0 8px; padding: 0; display: grid; gap: 6px; font-size: 13px; }
.slack-ws-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.slack-links { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.slack-links li { display: flex; align-items: center; gap: 10px; }
.slack-add { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 6px 0; }
.slack-add label { display: grid; gap: 4px; font-size: 13px; flex: 1 1 180px; min-width: 0; }
.slack-add select { width: 100%; }
.slack-manifest { max-height: 320px; overflow: auto; font-size: 12px; margin: 8px 0; }
.slack-steps { padding-left: 20px; display: grid; gap: 6px; }

/* ---- the chat app (app.go): only the chat, under a slim bar ---- */
body.app .app-shell { min-height: 100vh; display: flex; flex-direction: column; }
.app-top { align-items: center; padding: 0 16px; }
.app-brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 15px; font-weight: 500; white-space: nowrap; }
.app-brand:hover { text-decoration: none; }
.app-brand svg.logo { width: 26px; height: 26px; color: var(--brand-ink); flex: none; }
.app-brand b { font-weight: 700; }
.app-brand, .app-brand > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.app-main { max-width: none; }
.app-me > summary { display: flex; align-items: center; gap: 8px; padding: 4px 8px; border-radius: 8px; font-weight: 550; max-width: 220px; }
.app-me .menu-body > a { display: block; padding: 4px 0; }
.app-me .menu-body form { margin-top: 4px; }
.app-push:empty { display: none; }
.app-push .push-row { flex-wrap: wrap; }
/* Saving to My files or links and the vault live in the console, not here. */
body.app [data-save], body.app [data-save-link], body.app [data-save-links], body.app #vault-pick { display: none !important; }
.install-card { z-index: 62; }
.device-lost { z-index: 63; }
/* On a phone the bar can hold the call pill, Install app and the menu: the
   name is just "Chat", and the menu opens inside the screen's edges. */
@media (max-width: 520px) {
  .app-me > summary .ellipsis, .app-org { display: none; }
  .app-me .menu-body { position: fixed; left: 8px; right: 8px; top: calc(var(--top) + 4px); width: auto; }
}
.install-card button, .device-lost button { align-self: flex-start; }

/* ---- terminal windows (static/terminal.js): float over every console page ---- */
.tw { position: fixed; z-index: 30; display: flex; flex-direction: column; min-width: 0; background: #0f1214; color: #dfe6ea;
  border: 1px solid #2c3438; border-radius: 10px; overflow: hidden; box-shadow: 0 16px 44px rgba(0, 0, 0, .32), 0 2px 6px rgba(0, 0, 0, .18); }
.tw.tw-top { border-color: #3d5a4b; box-shadow: 0 20px 56px rgba(0, 0, 0, .42), 0 2px 8px rgba(0, 0, 0, .2); }
.tw.tw-min { visibility: hidden; pointer-events: none; }
.tw.tw-max { border-radius: 0; border-width: 0 0 0 1px; }
.tw.tw-moving { user-select: none; }
.tw-bar { flex: none; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 4px 0 11px; background: #1a1f22;
  font-size: 12.5px; cursor: grab; user-select: none; touch-action: none; }
.tw.tw-top .tw-bar { background: #1f2d27; }
.tw.tw-moving .tw-bar { cursor: grabbing; }
.tw.tw-max .tw-bar { cursor: default; }
.tw-title { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; }
.tw-title > svg { width: 15px; height: 15px; flex: none; color: #7fbf9c; }
.tw-title b { font-weight: 600; }
.tw-as { color: #9aa8b0; white-space: nowrap; }
.tw-as select { height: 24px; padding: 0 24px 0 7px; background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%; font-size: 12px; color: #dfe6ea; background-color: #262e32; border: 1px solid #3a4448; border-radius: 5px; cursor: pointer; }
.tw-state { font-size: 11.5px; color: #8c9aa2; white-space: nowrap; }
.tw-btns { display: flex; gap: 2px; flex: none; }
.tw-b { width: 28px; height: 26px; padding: 0; display: grid; place-items: center; border: 0; border-radius: 6px; background: transparent; color: #b8c4ca; }
.tw-b:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.tw-b.x:hover { background: #c0392b; }
.tw-b svg { width: 15px; height: 15px; }
.tw-body { position: relative; flex: 1; min-height: 0; padding: 6px 4px 6px 10px; }
.tw-term { width: 100%; height: 100%; }
.tw-note { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px;
  padding: 8px 10px; font-size: 12.5px; background: #1d2427; border: 1px solid #36424a; border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, .4); }
.tw-note span { flex: 1 1 200px; }
.tw-note button:not(.primary) { background: #262e32; border-color: #3a4448; color: #dfe6ea; }
.tw-grip { position: absolute; right: 0; bottom: 0; z-index: 6; width: 16px; height: 16px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 55%, #5c6a71 55%, #5c6a71 62%, transparent 62%, transparent 74%, #5c6a71 74%, #5c6a71 81%, transparent 81%); }
.tw.tw-max .tw-grip { display: none; }

/* The task bar: one button per terminal window of this tab. */
.tw-dock { position: fixed; left: 196px; right: 0; bottom: 0; z-index: 39; height: 40px; display: flex; align-items: center; gap: 6px;
  padding: 0 12px; background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -2px 10px rgba(16, 24, 32, .05); overflow-x: auto; transition: left .18s ease; }
.tw-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; max-width: 240px; height: 28px; padding: 0 10px; font-size: 12.5px; font-weight: 500;
  color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; }
.tw-chip svg { width: 14px; height: 14px; flex: none; color: var(--muted); }
.tw-chip.on { background: var(--accent-soft); border-color: var(--accent); }
.tw-chip.on svg { color: var(--accent); }
.tw-chip.min { color: var(--muted); border-style: dashed; background: transparent; }
.tw-chip-user { color: var(--muted); font-weight: 400; }
.tw-chip .dot, .tw-bar .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; background: var(--faint); }
.tw-chip .dot.up { background: #2fb36d; }
.tw-chip .dot.down { background: var(--bad); }
.tw-chip .dot.wait { background: var(--warn); }
body.has-dock .main { padding-bottom: 100px; }
body.has-dock .main:has(.chat) { padding-bottom: 16px; }
body.has-dock .chat { height: calc(100vh - var(--top) - 32px - 40px); }
body.has-dock :is(.toasts, .idle-toast, .offer-card) { bottom: 56px; }
@media (max-width: 860px) { .tw-dock { left: 0; } }
@media (max-width: 700px) { .tw { border-radius: 0; border-width: 1px 0 0; } .tw-state { display: none; } .tw-b[data-a="max"] { display: none; } }

/* Task bar chips: a chat's name and unread count; a chat someone wrote in. */
.tw-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tw-count { flex: none; min-width: 17px; height: 17px; padding: 0 5px; display: inline-grid; place-items: center; font-size: 11px; font-weight: 650;
  color: #fff; background: var(--bad); border-radius: 9px; font-variant-numeric: tabular-nums; }
.tw-chip.alert { color: var(--text); font-weight: 600; border: 1px solid var(--accent); background: var(--panel-2); animation: tw-alert 1.1s ease-in-out 3; }
@keyframes tw-alert { 50% { background: var(--accent-soft); } }
@media (prefers-reduced-motion: reduce) { .tw-chip.alert { animation: none; } }

/* ---- chat windows (static/chatwin.js): a conversation over any console page ---- */
.tw.chat { background: var(--panel); color: var(--text); border-color: var(--line); box-shadow: 0 14px 40px rgba(16, 24, 32, .18), 0 2px 6px rgba(16, 24, 32, .08); }
.tw.chat.tw-top { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); box-shadow: 0 18px 50px rgba(16, 24, 32, .24), 0 2px 8px rgba(16, 24, 32, .1); }
.tw.chat .tw-bar { background: var(--panel-2); border-bottom: 1px solid var(--line); }
.tw.chat.tw-top .tw-bar { background: var(--accent-soft); }
.tw.chat .tw-title > .cw-icon { display: flex; flex: none; color: var(--accent); }
.cw-icon svg { width: 15px; height: 15px; }
.tw.chat .tw-b { color: var(--muted); }
.tw.chat .tw-b:hover { background: var(--line); color: var(--text); }
.tw.chat .tw-b.x:hover { background: var(--bad); color: #fff; }
.tw.chat .tw-grip { background: linear-gradient(135deg, transparent 55%, var(--faint) 55%, var(--faint) 62%, transparent 62%, transparent 74%, var(--faint) 74%, var(--faint) 81%, transparent 81%); }
.tw.chat.cw-drop { outline: 2px dashed var(--accent); outline-offset: -4px; }
.cw-av { width: 20px; height: 20px; flex: none; display: inline-grid; place-items: center; border-radius: 50%; object-fit: cover;
  font-size: 9.5px; font-weight: 650; color: var(--accent); background: var(--accent-soft); }
.tw-chip .cw-av { width: 16px; height: 16px; font-size: 8px; }
.cw-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cw-msgs { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 2px; padding: 18px 12px 8px; }
.cw-more { align-self: center; margin-bottom: 4px; }
.cw-msg { display: flex; flex-direction: column; align-items: flex-start; max-width: 88%; min-width: 0; margin-top: 8px; }
.cw-msg:first-child, .cw-more + .cw-msg { margin-top: 0; }
.cw-msg.cont { margin-top: 0; }
.cw-msg.cont .cw-meta { display: none; }
.cw-msg.mine { align-self: flex-end; align-items: flex-end; }
.cw-meta { display: flex; align-items: baseline; gap: 6px; padding: 0 4px 2px; font-size: 11.5px; color: var(--faint); }
.cw-meta b { color: var(--muted); font-weight: 600; }
.cw-bubble { min-width: 0; max-width: 100%; padding: 6px 10px; border-radius: 12px; background: var(--panel-2); font-size: 13.5px; line-height: 1.42; overflow-wrap: anywhere; }
.cw-msg.mine .cw-bubble { background: var(--accent-soft); }
.cw-bubble .md p, .cw-bubble .md ul, .cw-bubble .md ol, .cw-bubble .md pre, .cw-bubble .md blockquote { margin-bottom: .35em; }
.cw-bubble .md.jumbo { font-size: 30px; line-height: 1.15; }
.cw-bubble .code-box { margin: 4px 0; }
.cw-bubble .code-box pre.chroma { font-size: 11.5px; }
.cw-quote { display: block; margin-bottom: 4px; padding: 1px 0 1px 8px; border-left: 3px solid var(--line); font-size: 12px; color: var(--muted); }
.cw-quote b { display: block; font-weight: 600; }
.cw-quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cw-quote.gone { font-style: italic; }
.cw-atts { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.cw-bubble > .cw-atts:first-child { margin-top: 0; }
.cw-img img { display: block; width: auto; height: auto; max-width: 100%; max-height: 220px; border-radius: 8px; }
.cw-file { display: flex; align-items: baseline; gap: 6px; min-width: 0; font-size: 12.5px; }
.cw-reacts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.cw-react { padding: 0 6px; font-size: 12px; line-height: 1.5; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); color: var(--text); cursor: pointer; }
.cw-react:hover { border-color: var(--accent); }
/* A message's actions in a chat window: over its top edge, on hover. */
.cw-msg { position: relative; }
.cw-acts { position: absolute; top: -19px; left: 2px; z-index: 2; display: none; gap: 1px; padding: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
/* From the bubble's outer edge inwards, so a short message's bar never sticks out of the window (Ilya, 2026-10-01). */
.cw-msg.mine .cw-acts { left: auto; right: 2px; }
.cw-msg:hover .cw-acts, .cw-msg.show-act .cw-acts, .cw-msg:focus-within .cw-acts { display: flex; }
.cw-act { display: inline-grid; place-items: center; width: 24px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--faint); cursor: pointer; }
.cw-act:hover { background: var(--panel-2); color: var(--accent); }
.cw-act.saved { color: var(--ok); }
.cw-msg.editing .cw-bubble { outline: 2px solid var(--accent); }
.cw-mode { display: flex; align-items: center; gap: 6px; padding: 4px 8px; margin-bottom: 4px; font-size: 12px; border-left: 3px solid var(--accent); background: var(--panel-2); border-radius: 4px; }
.cw-mode[hidden] { display: none; }
.cw-mode-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cw-pop { position: fixed; z-index: 70; }
.cw-react.me { border-color: var(--accent); }
.cw-call { align-self: center; display: flex; align-items: center; gap: 6px; margin: 8px 0 2px; font-size: 12px; color: var(--muted); }
.cw-call svg { width: 13px; height: 13px; }
.cw-note { flex: none; padding: 10px 12px; font-size: 12.5px; color: var(--muted); background: var(--panel-2); border-top: 1px solid var(--line); }
.cw-form { flex: none; display: flex; flex-direction: column; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.cw-form[hidden] { display: none; }
.cw-row { display: flex; align-items: flex-end; gap: 6px; }
.tw.chat .cw-text { flex: 1; min-width: 0; min-height: 34px; max-height: 120px; resize: none; padding: 6px 12px; font-size: 13.5px; line-height: 1.45; border-radius: 17px; background: var(--panel-2); }
.cw-attach, .cw-send { flex: none; width: 34px; height: 34px; padding: 0; justify-content: center; border: 0; border-radius: 50%; }
.cw-attach { background: transparent; color: var(--muted); }
.cw-attach:hover { background: var(--panel-2); color: var(--text); }
.cw-send, .cw-send:hover { background: var(--accent); color: #fff; }
.cw-send:disabled { opacity: .5; cursor: default; }
.cw-attach svg, .cw-send svg { width: 16px; height: 16px; }
.cw-pending { display: flex; flex-wrap: wrap; gap: 4px; }
.cw-pending[hidden] { display: none; }
.cw-pend { display: inline-flex; align-items: center; gap: 2px; max-width: 100%; padding: 2px 0 2px 9px; font-size: 12px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }

/* ---- the chat app on a phone (app.go, chatapp.js): the list of chats and a
   conversation are two screens, like WhatsApp. Only at chat.host.garden. ---- */
.chat-back, .row-last, .row-time { display: none; }
body.app .app-row .row-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.app .app-row .row-side { margin-left: auto; display: flex; align-items: center; }
body.app .chat-pick { margin: auto; }
@media (max-width: 860px) {
  body.app .main:has(.chat) { padding: 0; }
  body.app .chat { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); height: calc(100vh - var(--top)); height: calc(100dvh - var(--top)); border: 0; border-radius: 0; }
  body.app .chat:not(.chat-list-only) .chat-side, body.app .chat.chat-list-only .chat-main { display: none; }
  /* A conversation fills the screen under its own header, with the back arrow. */
  body.app:has(.chat:not(.chat-list-only)) .app-top { display: none; }
  body.app .chat:not(.chat-list-only) { height: 100vh; height: 100dvh; }
  body.app .msgs { max-height: none; padding: 10px 12px; }
  body.app .chat-head { padding: 8px 12px 8px 6px; }
  body.app .chat-title { flex-wrap: nowrap; gap: 6px; }
  body.app .chat-title h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
  body.app .chat-title .btn.small, body.app .chat-title button.small { font-size: 0; gap: 0; padding: 7px; }
  body.app .chat-title .faint { display: none; }
  body.app .chat-head .topic { padding-left: 34px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  body.app .chat-back { display: inline-flex; align-items: center; padding: 4px; border-radius: 50%; color: var(--text); flex: none; }
  body.app .chat-back:hover { background: var(--panel-2); text-decoration: none; }
  body.app .composer .hint { display: none; }
  /* The message box in one line, like WhatsApp: emoji, the text (growing as
     you type), a paperclip, and a round send button. */
  body.app .composer { padding: 6px 8px max(6px, env(safe-area-inset-bottom)); gap: 6px; align-items: flex-end; }
  body.app .composer .grow { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 2px 4px; }
  body.app .composer .grow > * { flex: 1 1 100%; }
  body.app .composer .composer-tools { display: contents; }
  body.app .composer .grow > textarea { order: 2; flex: 1 1 0; min-width: 0; height: 44px; min-height: 44px; max-height: 140px; padding: 11px 14px; border-radius: 22px; line-height: 1.35; resize: none; }
  body.app .composer .emoji-btn { order: 1; height: 44px; padding: 0 6px; border: 0; background: none; font-size: 22px; }
  /* Their words stay for screen readers (font-size 0); flex keeps the empty text beside the icon, not above it. */
  body.app .composer-tools label.btn { order: 3; width: 40px; height: 44px; margin: 0; padding: 0; border: 0; background: none; font-size: 0; line-height: 0; display: flex; align-items: center; justify-content: center; }
  body.app .composer-tools label.btn::before, body.app .composer > button.primary::before {
    content: ""; width: 22px; height: 22px; background: var(--muted);
    -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
  }
  body.app .composer-tools label.btn::before { --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m21.4 11.1-9.2 9.2a6 6 0 0 1-8.5-8.5l9.2-9.2a4 4 0 0 1 5.7 5.7l-9.2 9.2a2 2 0 0 1-2.8-2.8l8.5-8.5'/%3E%3C/svg%3E"); }
  body.app .composer > button.primary { flex: none; width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 0; line-height: 0; display: flex; align-items: center; justify-content: center; }
  /* The arrow's weight is on its left: moved 2px right so it looks centred. */
  body.app .composer > button.primary::before { background: #fff; transform: translateX(2px); --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M3.4 20.4 21 12 3.4 3.6l2.3 7.2 8.8 1.2-8.8 1.2z'/%3E%3C/svg%3E"); }
  /* Editing a message: a tick instead of the arrow. */
  body.app .composer:has(#edit-bar:not([hidden])) > button.primary::before { transform: none; --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E"); }
  /* The list: big rows with the newest message and its time. */
  body.app .chat-side { max-height: none; border: 0; padding: 8px 6px 24px; background: var(--panel); }
  body.app .chat-side a.app-row { padding: 9px 8px; gap: 12px; }
  body.app .app-row .avatar { width: 46px; height: 46px; font-size: 16px; }
  body.app .app-row .ch-mark { width: 46px; height: 46px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--panel-2); color: var(--muted); font-size: 18px; }
  body.app .app-row .pdot { width: 12px; height: 12px; }
  body.app .app-row .row-main { display: flex; flex-direction: column; gap: 2px; }
  body.app .app-row .row-name { font-size: 15.5px; overflow: hidden; text-overflow: ellipsis; }
  body.app .app-row .row-last { display: block; color: var(--muted); font-size: 13.5px; font-weight: 400; overflow: hidden; text-overflow: ellipsis; }
  body.app .app-row .row-side { flex-direction: column; align-items: flex-end; gap: 5px; align-self: stretch; justify-content: center; }
  body.app .app-row .row-time { display: block; font-size: 12px; color: var(--muted); font-weight: 400; }
  body.app .app-row.unread .row-time { color: var(--accent); font-weight: 600; }
  body.app .app-row .count { margin: 0; }
  body.app .chat-side a.on, body.app .chat-side a.on:hover { background: none; box-shadow: none; font-weight: inherit; }
  body.app .chat-side > a[href^="/chat/dm/"] { padding: 9px 8px; gap: 12px; font-size: 15.5px; }
  body.app .chat-side > a[href^="/chat/dm/"] .avatar { width: 46px; height: 46px; font-size: 16px; }
  /* Searching from the list: the results take the screen. */
  body.app .chat.chat-list-only.searching { grid-template-rows: auto minmax(0, 1fr); }
  body.app .chat.chat-list-only.searching .chat-main { display: flex; }
  body.app .chat.chat-list-only.searching .chat-side { padding-bottom: 0; }
  body.app .chat.chat-list-only.searching .chat-side > :not(.chat-search) { display: none; }
  body.app .chat.chat-list-only .chat-pick { display: none; }
}
/* Touch screens (phones, also sideways, and tablets): no keyboard hints under the chat app's message box,
   and text boxes at 16 px: an iPhone zooms the whole page in when a smaller one is tapped, which pushed
   the send button and the messages off the right edge (Ilya, 2026-10-02). */
@media (pointer: coarse) {
  body.app .composer .hint { display: none; }
  body.app :is(textarea, input, select) { font-size: 16px; }
  /* The console's chat page and chat windows too (Ilya, 2026-10-02: "apply it to the console chat too"). */
  .chat :is(textarea, input, select), .tw.chat :is(textarea, input, select) { font-size: 16px; }
}

/* ---- search everything (searchall.go) ---- */
.top-search { position: relative; display: flex; align-items: center; }
.top-search svg { position: absolute; left: 9px; color: var(--muted); pointer-events: none; }
.top-search input[type=search] { width: 170px; padding: 5px 10px 5px 30px; background: var(--panel-2); border-color: transparent; transition: width .15s; }
.top-search input[type=search]:focus { width: 260px; background: var(--panel); }
.top-search-link { display: none; color: var(--muted); }
.top-search-link.on, .top-search-link:hover { color: var(--text); }
@media (max-width: 860px) {
  .top-search { display: none; }
  .top-search-link { display: inline-flex; padding: 4px; }
}
.search-big { display: flex; gap: 8px; margin-bottom: 12px; }
.search-big input[type=search] { font-size: 16px; padding: 9px 12px; }
.search-tabs { margin-bottom: 12px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.search-tabs a { white-space: nowrap; }
.search-hits { padding: 6px; }
.search-hit { display: block; padding: 10px 12px; border-radius: 8px; color: var(--text); }
.search-hit:hover { background: var(--panel-2); text-decoration: none; }
.search-hit + .search-hit { border-top: 1px solid var(--line); }
.sh-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 12.5px; color: var(--muted); }
.sh-meta b { color: var(--text); font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.sh-where { font-weight: 600; color: var(--accent); }
.sh-text { margin-top: 3px; font-size: 14px; line-height: 1.5; overflow-wrap: anywhere; color: var(--text); }
.sh-text mark, .sp-text mark { background: rgba(240, 190, 60, .35); color: inherit; border-radius: 2px; padding: 0 1px; }
.sp-why { font-size: 11px; color: var(--muted); border: 1px solid var(--line); border-radius: 8px; padding: 0 6px; }
.search-hit.has-photo { display: flex; gap: 12px; align-items: flex-start; }
.sh-body { min-width: 0; flex: 1; }
.sh-photo { width: 76px; height: 76px; object-fit: cover; border-radius: 6px; flex: none; background: var(--panel-2); }
.search-hit.sh-wrap { padding: 0; }
.search-hit.sh-wrap:hover { background: none; }
.sh-link { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px 4px; border-radius: 8px; color: var(--text); }
.sh-link:hover { background: var(--panel-2); text-decoration: none; }
.sh-people { padding: 0 12px 10px 100px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.face-tag { display: inline-flex; align-items: center; gap: 4px; padding: 1px 4px 1px 8px; border-radius: 99px; background: var(--panel-2); }
.face-tag button { color: var(--muted); padding: 0 4px; line-height: 1.2; }
.face-tag button:hover { color: var(--bad); }
.face-how { margin: 0 0 8px; padding-left: 18px; }
.face-how li { margin: 3px 0; }
.face-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 12px; margin: 8px 0 12px; }
.face-card { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; text-align: center; }
.face-card img { width: 84px; height: 84px; border-radius: 50%; object-fit: cover; background: var(--panel-2); display: block; }
.face-card form { margin: 0; }
.face-selfie { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.sp-photo-row { display: flex; gap: 8px; align-items: flex-start; margin-top: 2px; }
.sp-photo { width: 52px; height: 52px; object-fit: cover; border-radius: 6px; flex: none; }
/* searchable mark on pictures (images.go) */
.att-img, .fthumb { position: relative; }
.srch-mark { position: absolute; left: 6px; bottom: 6px; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, .55); color: #fff; pointer-events: auto; }
.srch-mark.read { background: var(--accent); color: #fff; }
.srch-mark.waiting { opacity: .75; animation: srch-wait 1.6s ease-in-out infinite; }
@keyframes srch-wait { 50% { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .srch-mark.waiting { animation: none; } }
.related-terms { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: -2px 0 12px; }
.related-terms .chip { padding: 1px 9px; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: var(--panel); }
.related-terms .chip:hover { background: var(--panel-2); text-decoration: none; }
.related-head { font-size: 13px; font-weight: 600; color: var(--muted); margin: 18px 0 8px; }
.link-hit .sh-title { display: inline-block; margin-top: 3px; font-weight: 600; font-size: 14.5px; overflow-wrap: anywhere; }
.sh-via { font-size: 12.5px; }
.search-progress { color: var(--muted); margin-top: 2px; }
.search-progress.busy::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-right: 6px; animation: srch-wait 1.6s ease-in-out infinite; }

/* chat: the arrow to the newest message (chat.js). A zero-height row
   between the thread and the message box; the round button sits over the
   bottom of the thread. */
.to-end { position: relative; z-index: 5; align-self: flex-end; display: grid; place-items: center; width: 40px; height: 40px; margin: -52px 18px 12px 0; padding: 0;
  border: 1px solid var(--line); border-radius: 50%; background: var(--panel); color: var(--muted); box-shadow: 0 4px 14px rgba(0, 0, 0, .16); cursor: pointer;
  animation: to-end-in .15s ease-out; }
.to-end:hover { color: var(--accent); background: var(--panel); }
.to-end-n { position: absolute; top: -7px; right: -5px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--accent); color: #fff;
  font: 650 11px/20px system-ui, sans-serif; text-align: center; font-variant-numeric: tabular-nums; }
@keyframes to-end-in { from { opacity: 0; transform: translateY(6px); } }
@media (prefers-reduced-motion: reduce) { .to-end { animation: none; } }
body.app .to-end { margin-right: 12px; }

/* chat: forwarding (forward.js) */
.fwd-tag { display: flex; align-items: center; gap: 4px; margin: 1px 0 2px; font-size: 12px; font-style: italic; color: var(--muted); }
.fwd-tag svg { width: 12px; height: 12px; flex: none; }
.msg.mine .fwd-tag { justify-content: flex-end; }
.att-btns { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.att-btns .att-save { position: static; }
.att-fwd { padding: 2px 9px; font-size: 11.5px; font-weight: 600; border: 0; border-radius: 10px; background: rgba(10, 16, 18, .72); color: #fff; opacity: 0; transition: opacity .12s; }
.att:hover .att-fwd, .att-fwd:focus-visible { opacity: 1; }
.att-fwd:hover { background: rgba(10, 16, 18, .88); color: #fff; }
.att .att-file { padding-right: 132px; }
@media (hover: none) {
  .att-fwd { display: none; } /* phones: Forward is on the message (tap it) and in the photo viewer */
  .att .att-file { padding-right: 64px; }
}
.fwd-back { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(5, 10, 12, .45); }
.fwd-box { display: flex; flex-direction: column; gap: 10px; width: min(420px, 100%); max-height: min(560px, calc(100dvh - 32px)); padding: 14px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 50px rgba(0, 0, 0, .3); }
.fwd-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 15px; }
.fwd-what { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-left: 3px solid var(--accent-2); border-radius: 6px; background: var(--panel-2);
  color: var(--muted); font-size: 13px; min-width: 0; }
.fwd-what:not(:has(img, span:not(:empty))) { display: none; }
.fwd-what img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; flex: none; }
.fwd-what span { overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.fwd-list { display: flex; flex-direction: column; overflow-y: auto; min-height: 120px; margin: 0 -6px; }
.fwd-list.busy { opacity: .55; pointer-events: none; }
.fwd-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 8px; border: 0; border-radius: 8px; background: none; color: var(--text); text-align: left; font: inherit; cursor: pointer; }
.fwd-row:hover, .fwd-row[aria-selected="true"] { background: var(--panel-2); }
.fwd-row .avatar.sm, .fwd-mark { width: 28px; height: 28px; flex: none; }
.fwd-mark { display: grid; place-items: center; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 650; font-size: 13px; }
.fwd-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.fwd-kind { flex: none; font-size: 11.5px; color: var(--faint); }
.fwd-note { padding: 12px 8px; }
.fwd-err { padding: 8px 10px; border-radius: 6px; background: var(--bad-soft); color: var(--text); font-size: 13px; }
.toast.k-fwd { border-left-color: var(--accent); }
/* The chat app on a touch screen: a tapped follow-up message shows its
   buttons on a line of their own above it, not over its text. */
@media (hover: none) {
  body.app .msg.cont.show-act .meta { position: static; transform: none; margin: 0 0 2px; }
}

/* My files: sharing (fileshare.go) */
.shared-with { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); }
.shared-with svg { flex: none; }
.share-form .check { margin: 2px 0; }
.share-form .hint { font-size: 11.5px; color: var(--muted); margin: 6px 0 0; }
.shared-head { font-size: 15px; margin-bottom: 10px; scroll-margin-top: 70px; }
.k-file.ni-kind { background: #8a6bbf; } .k-file.ni-kind::before { content: "↗"; }
.toast.k-file { border-left-color: #8a6bbf; }

/* Which message sound (Notifications page) */
.chime-pick { display: flex; flex-wrap: wrap; gap: 6px 10px; margin: 0 0 8px 24px; }
.chime { display: inline-flex; align-items: center; gap: 6px; font-weight: 400; padding: 3px 4px 3px 8px; border: 1px solid var(--line); border-radius: 999px; }
.chime:has(input:checked) { border-color: var(--accent); }
.chime-ring { margin: 0 0 8px 24px; display: flex; align-items: center; gap: 6px; }
.chime-try { padding: 1px 7px; border-radius: 999px; line-height: 1.3; }

/* Account page: Look (light, dark, as the computer) */
.theme-pick { display: inline-flex; flex-wrap: wrap; }
.theme-pick label { display: inline-flex; margin: 0; cursor: pointer; }
.theme-pick input { position: absolute; opacity: 0; pointer-events: none; }
.theme-pick span { padding: 5px 12px; color: var(--muted); background: var(--panel); font-weight: 500; }
.theme-pick label + label span { border-left: 1px solid var(--line); }
.theme-pick input:checked + span { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.theme-pick input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: -2px; }

/* ---- Planning: the row of tabs over Tickets, Milestones and Ideas ---- */
.sub-tabs { display: flex; gap: 4px; margin: -4px 0 16px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.sub-tabs a { display: flex; align-items: center; gap: 6px; padding: 6px 12px 8px; color: var(--muted); font-weight: 550; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.sub-tabs a:hover { color: var(--text); text-decoration: none; }
.sub-tabs a.on { color: var(--text); border-bottom-color: var(--accent); }
.sub-tabs .count { margin-left: 0; }

/* ---- ideas (ideas.go) ---- */
.ideas { padding: 4px 0; }
.idea-row { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.idea-row:last-child { border-bottom: 0; }
.idea-main { flex: 1; min-width: 0; }
.idea-head { display: flex; align-items: flex-start; gap: 14px; min-width: 0; }
.idea-vote { flex: none; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0; width: 46px; height: 50px; padding: 0;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); color: var(--muted); cursor: pointer; font-size: 11px; line-height: 1.1; }
.idea-vote b { font-size: 15px; color: var(--text); }
.idea-vote:hover { border-color: var(--accent); color: var(--accent); }
.idea-vote.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.idea-vote.on b { color: var(--accent); }
.badge.idea-new { background: #e6eef8; color: #2c5d8f; }
.badge.idea-considering { background: var(--warn-soft); color: var(--warn); }
.badge.idea-planned { background: #efe7f8; color: #6a3fa0; }
.badge.idea-done { background: var(--accent-soft); color: var(--accent); }
.badge.idea-dropped { color: var(--faint); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .badge.idea-new { background: #1c2a3a; color: #8db8e6; }
  :root:not([data-theme="light"]) .badge.idea-planned { background: #2a2038; color: #c2a3ea; }
}
:root[data-theme="dark"] .badge.idea-new { background: #1c2a3a; color: #8db8e6; }
:root[data-theme="dark"] .badge.idea-planned { background: #2a2038; color: #c2a3ea; }

/* A DM window's title: the person's name, and under it whether they are online or when last seen. */
.cw-names { display: flex; flex-direction: column; min-width: 0; line-height: 1.15; }
.cw-status { font-size: 10.5px; font-weight: 500; color: var(--faint); }
.cw-status.online { color: var(--ok); }
.cw-status.idle { color: var(--warn); }
.cw-icon .av-wrap .pdot, .tw-chip .av-wrap .pdot { width: 8px; height: 8px; right: -2px; bottom: -2px; border-width: 1.5px; }

/* Message previews under the sender's picture in the header (live.js). */
.who-av.has-preview .avatar { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--accent); }
.msg-previews { position: fixed; z-index: 72; display: flex; flex-direction: column; gap: 10px; width: 300px; }
.msg-preview { position: relative; display: flex; align-items: flex-start; gap: 10px; padding: 10px 8px 10px 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .16); cursor: pointer; animation: toast-in .18s ease-out; }
.msg-preview:hover { border-color: var(--accent); }
.msg-preview::before { content: ""; position: absolute; top: -6px; left: calc(var(--arrow, 24px) - 6px); width: 10px; height: 10px; background: var(--panel);
  border-left: 1px solid var(--line); border-top: 1px solid var(--line); transform: rotate(45deg); }
.msg-preview + .msg-preview::before { display: none; }
.msg-preview:hover::before { border-color: var(--accent); }
.msg-preview .avatar { width: 30px; height: 30px; font-size: 12px; }
.mp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; font-size: 13px; }
.mp-text { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.mp-more { font-size: 11.5px; color: var(--accent); font-weight: 600; }
.mp-x { flex: none; width: 24px; height: 24px; padding: 0; border: 0; border-radius: 6px; background: none; color: var(--faint); font-size: 17px; line-height: 1; cursor: pointer; }
.mp-x:hover { background: var(--panel-2); color: var(--text); }

/* ---- screen capture (capture.go) and My files in a chat (sendmine.go) ---- */
button.hbtn { padding: 0; }
.mine-results { max-height: 280px; }
.mine-head { font-size: 11.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 6px 8px 2px; }
.mine-result { justify-content: flex-start; gap: 10px; text-align: left; white-space: normal; padding: 5px 8px; }
.mine-result:disabled { opacity: .5; }
.mine-thumb { flex: none; width: 36px; height: 36px; border-radius: 6px; object-fit: cover; background: var(--panel-2); }
.mine-ext { display: grid; place-items: center; font-size: 9.5px; font-weight: 700; color: var(--muted); border: 1px solid var(--line); }
.mine-text { display: flex; flex-direction: column; min-width: 0; }
.mine-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mine-text .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* The chat app on a phone: My files as an icon beside the paperclip (capture needs a computer). */
@media (max-width: 860px) {
  body.app .composer-tools .mine-btn { order: 3; width: 40px; height: 44px; margin: 0; padding: 0; border: 0; background: none; font-size: 0; line-height: 0; display: flex; align-items: center; justify-content: center; }
  body.app .composer-tools .mine-btn::before { content: ""; width: 22px; height: 22px; background: var(--muted); -webkit-mask: var(--icon) center / contain no-repeat; mask: var(--icon) center / contain no-repeat;
    --icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'%3E%3Cpath d='M3 6.5A1.5 1.5 0 0 1 4.5 5H9l2 2.5h8.5A1.5 1.5 0 0 1 21 9v9.5a1.5 1.5 0 0 1-1.5 1.5h-15A1.5 1.5 0 0 1 3 18.5z'/%3E%3C/svg%3E"); }
  body.app .composer-tools .cap-menu { display: none !important; }
}
/* Videos play where they are sent (inlineVideos in media.go). */
.att-video { display: flex; flex-direction: column; gap: 4px; width: min(420px, 100%); }
.att-video video { display: block; width: 100%; max-height: 320px; border-radius: 8px; border: 1px solid var(--line); background: #000; }
.att-vname { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-size: 12.5px; color: var(--muted); }
.att-vname .att-name { color: var(--text); }
.att-vname .srch-mark { position: static; }
.cw-video { display: flex; flex-direction: column; gap: 3px; max-width: 100%; font-size: 12px; }
.cw-video video { display: block; max-width: 100%; max-height: 220px; border-radius: 8px; background: #000; }
.fthumb.fvideo { background: #000; }
.fthumb.fvideo video { width: 100%; height: 100%; object-fit: contain; display: block; }

/* Chat lists and message boxes scroll up and down only (Ilya, 2026-10-01); code blocks scroll sideways inside themselves. */
.msgs, .cw-msgs { overflow-x: hidden; }
.composer textarea, .tw.chat .cw-text { overflow-x: hidden; overflow-wrap: anywhere; }

/* An on/off switch (a checkbox): ideas' "Can be monetised". */
label.switch { display: inline-flex; align-items: center; gap: 10px; margin: 0; cursor: pointer; font-weight: 550; }
label.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; flex: none; width: 36px; height: 20px; border-radius: 10px; background: var(--line); transition: background .15s; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--panel); box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .15s; }
label.switch input:checked + .switch-track { background: var(--accent); }
label.switch input:checked + .switch-track::after { transform: translateX(16px); }
label.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
#money-how label { display: block; margin-bottom: 4px; }
.idea-money { margin-top: 12px; padding: 10px 12px; border-radius: 8px; background: var(--warn-soft); border-left: 3px solid var(--warn); }
.idea-money .md { margin-top: 4px; }
.badge.idea-money-badge { background: var(--warn-soft); color: var(--warn); }

/* "Sent" / "Seen 14:02" and who has read how far, in a chat window. */
.cw-read { padding: 2px 4px 0; font-size: 10.5px; color: var(--faint); }
.cw-read.seen { color: var(--accent); }
.cw-read-marks { display: flex; gap: 2px; justify-content: flex-end; align-self: stretch; }
.cw-read-marks .avatar { width: 14px; height: 14px; font-size: 7px; }

/* ---- the sidebar's foot: "Install app" and collapsing the sidebar ---- */
.side-foot { margin-top: auto; padding: 10px 8px 0; display: flex; align-items: center; gap: 8px; }
.side-admin + .side-foot { margin-top: 0; }
.side-install { display: inline-flex; align-items: center; gap: 6px; background: none; border: 0; padding: 3px 0; font: inherit; font-size: 11.5px;
  color: var(--side-muted); cursor: pointer; white-space: nowrap; }
.side-install:hover { color: var(--side-text); text-decoration: underline; }
.side-toggle { margin-left: auto; flex: none; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 6px;
  background: none; color: var(--side-muted); cursor: pointer; }
.side-toggle:hover { background: rgba(255, 255, 255, .08); color: var(--side-text); }
.side-toggle svg { transition: rotate .18s; }
.side .side-ic { flex: none; opacity: .75; }
@media (max-width: 860px) {
  .side-foot { display: none; }
  /* The top bar on phones: the admin links as words only, and allowed to shrink (their icons made the page too wide). */
  .side .side-ic { display: none; }
  .side-admin { min-width: 0; }
}
/* Collapsed: a strip with the logo, the nodes' dots and the admin icons; names show on hover. */
@media (min-width: 861px) {
  .shell.side-narrow { --side-w: 52px; }
  body:has(.shell.side-narrow) .tw-dock { left: 52px; }
  .side-narrow .side { padding-inline: 6px; }
  .side-narrow .brand { padding: 4px 0 10px; justify-content: center; }
  .side-narrow .side .lbl, .side-narrow .nav-label > * { display: none; }
  .side-narrow .nav-label { padding: 10px 6px 6px; font-size: 0; }
  .side-narrow .nav-label::before { content: ""; flex: 1; border-top: 1px solid rgba(255, 255, 255, .12); }
  .side-narrow .side nav a { justify-content: center; padding: 8px 0; }
  .side-narrow .side nav .dot { width: 9px; height: 9px; }
  .side-narrow .side-foot { flex-direction: column; padding: 10px 0 0; }
  .side-narrow .side-install { padding: 5px; }
  .side-narrow .side-toggle { margin: 0; }
  .side-narrow .side-toggle svg { rotate: 180deg; }
}
/* The message box's tools as small icons (Ilya, 2026-10-01); the words stay for screen readers. */
.composer-tools .ctool { width: 32px; height: 30px; padding: 0; justify-content: center; border-color: transparent; background: none; color: var(--muted); cursor: pointer; }
.composer-tools .ctool:hover, .composer-tools details[open] > .ctool, .composer-tools .ctool[aria-expanded="true"] { background: var(--panel-2); color: var(--text); }
.ctool-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.composer-tools .emoji-btn { border-color: transparent; background: none; }
.composer-tools .emoji-btn:hover { background: var(--panel-2); }
/* The chat app on a phone draws its own paperclip and folder (above). */
@media (max-width: 860px) { body.app .composer-tools .ctool > svg { display: none; } }

/* ---- Vault: private items and Subscriptions (subscriptions.go) ---- */
.badge.private { background: #f3ecdf; color: #7a5a1f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.private { background: #3a3122; color: #e2c78f; } }
:root[data-theme="dark"] .badge.private { background: #3a3122; color: #e2c78f; }
.vq-private { display: flex; align-items: center; gap: 6px; color: var(--muted); }
.sub-totals { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 14px; }
.sub-total { display: flex; flex-direction: column; gap: 1px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); min-width: 180px; }
.sub-total b { font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.sub-total span { font-size: 12.5px; color: var(--muted); }
.subs .num, dd.num { font-variant-numeric: tabular-nums; }
.subs tr.sub-off td { opacity: .6; }
.sub-soon { color: var(--accent-2); font-weight: 600; }
.sub-trial { color: var(--accent-2); }
input.upper { text-transform: uppercase; }
/* Files waiting to be sent, as tiles (HG.fileTile in app.js). */
.pending-files, .cw-pending { gap: 10px; padding-top: 6px; }
.ftile { position: relative; display: inline-flex; flex-direction: column; width: 84px; font-size: 11.5px; line-height: 1.3; }
.ftile-pic, .ftile-doc { width: 84px; height: 64px; border-radius: 8px; border: 1px solid var(--line); }
.ftile-pic { object-fit: cover; display: block; background: var(--panel-2); }
.ftile-doc { --k: #7b8794; position: relative; display: grid; place-items: center; background: color-mix(in srgb, var(--k) 12%, var(--panel)); overflow: hidden; }
.ftile-doc::before { content: ""; position: absolute; top: 9px; width: 30px; height: 36px; border-radius: 3px 9px 3px 3px; border: 1.6px solid var(--k); background: var(--panel); opacity: .9; }
.ftile-ext { position: relative; margin-top: 18px; padding: 1px 5px; border-radius: 4px; background: var(--k); color: #fff; font-size: 9.5px; font-weight: 700; letter-spacing: .03em; max-width: 72px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ftile-doc.k-pdf { --k: #d93a30; } .ftile-doc.k-doc { --k: #2f6fd0; } .ftile-doc.k-sheet { --k: #1f8a4c; } .ftile-doc.k-slides { --k: #d9772b; }
.ftile-doc.k-zip { --k: #8a6d3b; } .ftile-doc.k-video { --k: #8b5cc4; } .ftile-doc.k-audio { --k: #1c9a9a; } .ftile-doc.k-text { --k: #5f6873; }
.ftile-name { margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.ftile-size { color: var(--faint); font-size: 10.5px; }
.ftile-x { position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; padding: 0; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 14px; line-height: 1; box-shadow: 0 1px 4px rgba(0, 0, 0, .15); }
.ftile-x:hover { background: var(--bad); border-color: var(--bad); color: #fff; }
.cw-pending .ftile { width: 64px; } .cw-pending .ftile-pic, .cw-pending .ftile-doc { width: 64px; height: 50px; }
.cw-pending .ftile-doc::before { top: 6px; width: 24px; height: 29px; } .cw-pending .ftile-ext { margin-top: 12px; }
/* My files / My links: the note at the top instead of a form (Ilya, 2026-10-01). */
.drop-note { display: flex; align-items: center; gap: 16px; margin: 4px 0 8px; padding: 16px 18px;
  border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line)); border-radius: 14px;
  background: linear-gradient(120deg, var(--accent-soft), color-mix(in srgb, var(--accent-soft) 35%, var(--panel)) 70%); box-shadow: var(--shadow); }
.drop-note-ico { flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent); }
.drop-note-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.drop-note-text b { font-size: 14.5px; font-weight: 650; color: var(--text); }
.drop-note-text span { font-size: 13px; color: var(--muted); line-height: 1.45; }
.drop-note .drop-note-busy { display: none; color: var(--accent); font-weight: 600; }
.drop-note.busy .drop-note-busy { display: block; }
.drop-note.busy .drop-note-text b + span { display: none; }
.drop-note-pick { flex: none; }
.drop-note .file-pick { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; margin: 0; }
.drop-note .file-pick .pending-files { justify-content: flex-end; }
.drop-note.dragging { outline: 2px dashed var(--accent); outline-offset: 3px; }
.link-add[data-link-drop] { margin: 0 0 8px; }
@media (max-width: 640px) { .drop-note { flex-wrap: wrap; } .drop-note-text { flex-basis: calc(100% - 60px); } .drop-note .file-pick, .drop-note > .drop-note-pick { margin-left: 60px; align-items: flex-start; } }
/* Filters and sorting: more room above, taller (Ilya, 2026-10-01). */
.photo-tools { margin: 18px 0 14px; }
.sort-pick select { height: 38px; line-height: 36px; padding: 0 36px 0 35px; }
.view-pick { padding: 3px; }
.view-pick button { width: 36px; height: 30px; }
.head .actions .seg { margin-top: 6px; }
.head .actions .seg a, .head .actions .seg button { padding: 8px 15px; }
.head .actions input[type="search"] { height: 38px; margin-top: 6px; }

/* Pages of a long list (pager.go, "pager" in partials.html). */
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin: 12px 0 4px; }
.pager-steps { display: inline-flex; align-items: center; gap: 10px; }
.pager select { width: auto; padding: 3px 28px 3px 8px; background-position: calc(100% - 15px) 55%, calc(100% - 10px) 55%; }

/* The second factor (totp.go, stepup.go): the confirmation dialog (HG.ask2FA),
   the nag bar, the app's setup page and the recovery codes. */
.stepup-dim { position: fixed; inset: 0; z-index: 1200; background: rgba(5, 22, 24, .55); display: grid; place-items: center; padding: 16px; }
.stepup-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; width: min(380px, 100%); display: grid; gap: 12px; }
.stepup-card h2 { margin: 0; font-size: 18px; }
.stepup-card p { margin: 0; color: var(--muted); font-size: 13.5px; }
.stepup-card .error { margin: 0; padding: 8px 10px; }
.stepup-btns { display: flex; justify-content: flex-end; gap: 8px; }
.flash.warn { background: var(--warn-soft); border-color: transparent; color: var(--text); }
.flash.warn a { font-weight: 600; }
.twofa-qr { display: flex; flex-wrap: wrap; gap: 18px; align-items: center; margin: 10px 0 18px; }
.twofa-qr img { border-radius: 8px; background: #fff; padding: 6px; border: 1px solid var(--line); }
.totp-secret { display: inline-block; font-family: var(--mono); font-size: 15px; letter-spacing: .08em; padding: 6px 10px; background: var(--accent-soft); border-radius: 6px; margin: 6px 0; user-select: all; word-break: break-all; }
.twofa-confirm { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.twofa-confirm .code-input { width: 190px; }
.recovery-codes { list-style: none; padding: 0; margin: 12px 0 16px; display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 8px; }
.recovery-codes code { display: block; font-family: var(--mono); font-size: 15px; padding: 8px 10px; background: var(--accent-soft); border-radius: 6px; text-align: center; letter-spacing: .05em; }

/* The account service, account.host.garden (public.go): its own header and the hub. */
body.pub { background: var(--bg); }
.pub-shell { max-width: 980px; margin: 0 auto; padding: 0 16px 40px; }
.pub-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.pub-top .app-brand { color: var(--text); }
.pub-nav { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.pub-nav a { color: var(--muted); padding: 6px 2px; border-bottom: 2px solid transparent; }
.pub-nav a.on { color: var(--text); border-color: var(--accent); }
.pub-nav a:hover { text-decoration: none; color: var(--text); }
.pub-main { padding: 0; }
.hub-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin: 6px 0 16px; }
.hub-tile { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 18px 18px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--text); }
.hub-tile:hover { text-decoration: none; border-color: var(--accent); }
.hub-tile b { font-size: 16px; }
.hub-tile .apps-tile { width: 46px; height: 46px; }
.hub-note { font-size: 13px; color: var(--muted); line-height: 1.4; }
.hub-more { margin-top: 10px; }
.invite-form { align-items: flex-end; margin-bottom: 14px; }
.invite-form .field { margin: 0; }
@media (max-width: 640px) { .pub-top { flex-wrap: wrap; } }

/* Storage (storage.html): the limit typed in GB */
.store-in { width: 92px; }
