/* SPDX-License-Identifier: GPL-3.0-or-later */
/* The apps' fonts: Inter for the interface, JetBrains Mono for terminals,
   and the decorated skins' own (Crimson Pro, Courier Prime and Cinzel for
   Steampunk, Cormorant Garamond and Grenze Gotisch for Cursed), which a
   browser fetches only when the skin in use asks for them (SIL Open Font
   License; fonts/*-LICENSE.txt). */
@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-SemiBold.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/JetBrainsMono-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url("fonts/JetBrainsMono-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Crimson Pro"; src: url("fonts/CrimsonPro-Regular.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Crimson Pro"; src: url("fonts/CrimsonPro-SemiBold.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("fonts/CourierPrime-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Courier Prime"; src: url("fonts/CourierPrime-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("fonts/Cinzel-Regular.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Cinzel"; src: url("fonts/Cinzel-Bold.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("fonts/CormorantGaramond-Medium.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Cormorant Garamond"; src: url("fonts/CormorantGaramond-SemiBold.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Grenze Gotisch"; src: url("fonts/GrenzeGotisch-Regular.woff2") format("woff2"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "Grenze Gotisch"; src: url("fonts/GrenzeGotisch-Bold.woff2") format("woff2"); font-weight: 600 700; font-display: swap; }

:root {
  --z: 1;
  /* Default Light and Default Dark, as in the apps; the skin picker
     replaces these (CSS variables set by the page). */
  --bg: #f5f6f7; --card: #ffffff; --input: #ffffff; --text: #1c2026; --muted: #566070;
  --border: #d3d8de; --accent: #b9532a; --accent-text: #ffffff; --ok: #2a7b70;
  --warn: #8a6200; --err: #8a1f1f; --hover: #eceef1; --selected: #b9532a22;
  --term-bg: #ffffff; --sidebar: #eceef1; --titlebar: #e3e6ea; --danger-bg: #fbe3e3;
  --folder: #b9532a;
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --display: var(--ui);
  --radius: 8px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c2026; --card: #262c34; --input: #16191e; --text: #f1f3f5; --muted: #9aa4b0;
    --border: #323943; --accent: #e8823f; --accent-text: #1a1009; --ok: #6fd0bf;
    --warn: #e8c25a; --err: #f3a5a0; --hover: #20252c; --selected: #e8823f26;
    --term-bg: #16191e; --sidebar: #20252c; --titlebar: #16191e; --danger-bg: #3a2424;
    --folder: #e8823f;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); overflow: hidden;
  font: calc(13px * var(--z))/1.45 var(--ui);
}
.spacer { flex: 1; }
.brand { font-weight: 600; font-size: calc(15px * var(--z)); }
.tag {
  font-size: calc(12px * var(--z)); padding: 1px 8px; border-radius: 999px;
  background: var(--accent); color: var(--accent-text);
}
.card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
}
.narrow { max-width: 420px; margin: 0 auto; }
h1 { font-size: calc(20px * var(--z)); font-weight: 600; margin: 0 0 12px; }
h2 { font-size: calc(16px * var(--z)); font-weight: 600; margin: 0 0 12px; overflow-wrap: anywhere; }
.status { font-weight: 600; }
.status.ok { color: var(--ok); }
.status.err { color: var(--err); }
.muted { color: var(--muted); }
.small { font-size: calc(12px * var(--z)); }

form { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 4px; font-weight: 500; font-size: calc(13px * var(--z)); }
input, select {
  font: inherit; color: inherit; background: var(--input);
  border: 1px solid var(--border); border-radius: 6px; padding: 7px 10px; width: 100%;
}
input:focus, select:focus, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button {
  font: inherit; cursor: pointer; border-radius: 6px; padding: 6px 14px;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
}
button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
button.secondary:hover { background: var(--hover); }
button:disabled { opacity: 0.6; cursor: default; }
.banner { padding: 10px 14px; border-radius: 8px; margin: 0 0 16px; }
.banner.err { color: var(--err); border: 1px solid var(--err); background: var(--danger-bg); }
.banner.warn { color: var(--warn); border: 1px solid var(--warn); }
.note { color: var(--ok); }

/* The window, as in the apps: sidebar, title bar with the tabs, the page or
   the sessions, and the status bar. */
.window { height: 100vh; height: 100dvh; display: flex; }
.window:not(.signed-in) { display: block; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.content > .banner { margin: 12px 16px 0; display: flex; align-items: center; gap: 8px; }
.content > .banner button.link { margin-left: auto; color: inherit; font-size: calc(16px * var(--z)); }
.icon-btn {
  background: transparent; border: 0; color: var(--muted); padding: 4px 6px;
  font-size: calc(15px * var(--z)); line-height: 1; border-radius: 5px;
}
.icon-btn:hover { color: var(--text); background: var(--input); }

/* The sidebar. */
.sidebar {
  width: 260px; flex: none; display: flex; flex-direction: column; min-height: 0;
  background: var(--sidebar); border-right: 1px solid var(--border);
}
.side-title {
  height: 44px; flex: none; display: flex; align-items: center; padding: 0 10px 0 20px;
  border-bottom: 1px solid var(--border);
}
.side-search { padding: 12px 12px 4px; flex: none; }
.side-search input { padding: 9px 12px; border-radius: var(--radius); }
.side-tree { flex: 1; min-height: 0; overflow: auto; padding: 0 8px 8px; }
.ws-head {
  display: flex; align-items: center; gap: 6px; padding: 14px 8px 4px;
  font-size: calc(11px * var(--z)); font-weight: 600; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em;
}
.ws-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-head .plus { font-size: calc(15px * var(--z)); font-weight: 400; width: 20px; height: 20px; padding: 0; }
.side-list { list-style: none; margin: 0; padding: 0; }
.folder-row, .host-row { border-radius: 6px; cursor: pointer; user-select: none; }
.folder-row:hover, .host-row:hover { background: var(--input); }
.folder-row.selected, .host-row.selected { background: var(--selected); }
.folder-row:focus-visible, .host-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.folder-row { display: flex; align-items: center; gap: 6px; height: 28px; padding-right: 8px; }
.chev {
  width: 12px; flex: none; padding: 0; border: 0; background: transparent;
  color: var(--muted); font-size: calc(10px * var(--z));
}
.glyph-folder {
  position: relative; display: inline-block; width: 13px; height: 9px; flex: none;
  border: 1px solid currentColor; border-radius: 0 1.5px 1.5px 1.5px; margin-top: 2px;
}
.glyph-folder::before {
  content: ""; position: absolute; left: -1px; top: -4px; width: 6px; height: 3px;
  border: 1px solid currentColor; border-bottom: 0; border-radius: 1.5px 1.5px 0 0;
}
.folder-row .glyph-folder { color: var(--folder); }
.folder-name {
  flex: 1; min-width: 0; font-weight: 600; color: var(--folder);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sort { font-size: calc(11px * var(--z)); color: var(--muted); }
.host-row {
  position: relative; height: 42px; display: flex; flex-direction: column;
  justify-content: center; padding-right: 8px;
}
.host-row .line { display: flex; align-items: center; gap: 10px; min-width: 0; }
.host-row .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host-row .proto { width: 40px; flex: none; text-align: right; font-size: calc(11px * var(--z)); color: var(--muted); }
.host-row .addr {
  font-size: calc(11px * var(--z)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-btns {
  position: absolute; top: 4px; bottom: 4px; right: 4px; display: none;
  align-items: center; gap: 4px; padding: 0 4px 0 6px; border-radius: 6px;
  background: var(--sidebar);
}
.row-btns:empty { display: none !important; }
.host-row:hover .row-btns, .host-row.selected .row-btns, .host-row:focus-within .row-btns { display: flex; }
.rb {
  width: 26px; height: 26px; padding: 0; border: 0; border-radius: 5px; background: transparent;
  color: var(--muted); font-family: var(--mono); font-size: calc(10.5px * var(--z));
  display: inline-flex; align-items: center; justify-content: center;
}
.rb:hover { background: var(--input); color: var(--text); }
.rb .glyph-folder { margin-top: 3px; }
.glyph-metrics {
  display: inline-block; width: 12px; height: 10px; flex: none;
  background: linear-gradient(currentColor, currentColor) 0 100% / 3px 5px no-repeat,
    linear-gradient(currentColor, currentColor) 4px 100% / 3px 10px no-repeat,
    linear-gradient(currentColor, currentColor) 8px 100% / 3px 7px no-repeat;
}
.side-empty, .side-note { padding: 8px; margin: 0; color: var(--muted); font-size: calc(12px * var(--z)); }
.side-foot {
  flex: none; display: flex; align-items: center; gap: 4px; padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.side-foot .new-host { padding: 7px 14px; font-weight: 500; white-space: nowrap; }
.side-foot .ghost { white-space: nowrap; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-foot .settings { flex: none; }
.side-foot .ghost {
  background: transparent; border: 0; color: var(--muted); padding: 7px 8px;
}
.side-foot .ghost:hover, .side-foot .ghost.current { color: var(--text); }
.side-foot .settings .ico { width: 18px; height: 18px; }

/* The title bar and its tabs. */
.titlebar {
  height: 44px; flex: none; display: flex; align-items: flex-end; gap: 4px; padding: 0 8px;
  background: var(--titlebar); border-bottom: 1px solid var(--border);
}
.titlebar .show-side { align-self: center; }
.tabstrip {
  display: flex; align-items: flex-end; gap: 2px; flex: 1; min-width: 0; height: 100%;
  overflow-x: auto; overflow-y: hidden; scrollbar-width: none;
}
.tab {
  position: relative; height: 34px; min-width: 72px; flex: none; margin-bottom: -1px;
  display: inline-flex; align-items: center; gap: 8px; padding: 0 12px 0 14px;
  border: 1px solid transparent; border-bottom: 0;
  border-radius: var(--radius) var(--radius) 0 0;
  background: transparent; color: var(--muted); white-space: nowrap; font: inherit; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.current { background: var(--bg); border-color: var(--border); color: var(--text); font-weight: 500; }
.tab.picked { border-color: var(--accent); background: var(--selected); }
.tab-name {
  display: inline-flex; align-items: center; gap: 8px; padding: 0; border: 0;
  background: transparent; color: inherit; font: inherit; max-width: 220px;
}
.tab-title { overflow: hidden; text-overflow: ellipsis; }
.ico { width: 16px; height: 16px; display: block; flex: none; }
.ico.tab-glyph { width: 11px; height: 11px; color: var(--accent); }
.tab-badge { font-size: calc(10px * var(--z)); font-weight: 600; color: var(--muted); }
.tab-close {
  width: 16px; height: 16px; padding: 0; border: 0; border-radius: 3px; background: transparent;
  color: var(--muted); font-size: calc(13px * var(--z)); line-height: 1; visibility: hidden;
}
.tab:hover .tab-close, .tab.current .tab-close, .tab-close:focus-visible { visibility: visible; }
.tab-close:hover { color: var(--text); }
.tab-new {
  align-self: center; flex: none; background: transparent; border: 0; color: var(--muted);
  font-size: calc(17px * var(--z)); padding: 2px 10px; line-height: 1;
}
.tab-new:hover { color: var(--text); }
.titlebar-btn {
  align-self: center; flex: none; background: transparent; border: 0; color: var(--muted);
  padding: 6px 10px;
}
.titlebar-btn:hover, .titlebar-btn.on { color: var(--text); }
.snippets-toggle { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; background: var(--c); --c: var(--muted); }
.dot.ok { --c: var(--ok); }
.dot.busy, .dot.warn { --c: var(--warn); }
.dot.err { --c: var(--err); }
.dot.off { --c: var(--muted); }

/* The status bar. */
.statusbar {
  height: 26px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 14px;
  border-top: 1px solid var(--border); background: var(--titlebar); color: var(--muted);
  font-size: calc(11.5px * var(--z)); white-space: nowrap; overflow: hidden;
}
.status-item { overflow: hidden; text-overflow: ellipsis; }
.status-item.accent { color: var(--accent); }
.status-item.ok { color: var(--ok); }
.status-link {
  background: transparent; border: 0; padding: 0; font: inherit; color: var(--warn); cursor: pointer;
}
.status-link:hover { text-decoration: underline; }

/* Menus (right-click, Settings). */
.menu-backdrop { position: fixed; inset: 0; z-index: 40; }
.menu {
  position: fixed; z-index: 41; min-width: 190px; max-width: 280px; padding: 4px;
  display: flex; flex-direction: column; border-radius: 8px;
  background: var(--card); border: 1px solid var(--border);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
}
.menu-item {
  height: 28px; flex: none; padding: 0 10px; border: 0; border-radius: 5px; text-align: left;
  background: transparent; color: var(--text); white-space: nowrap;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--selected); outline: none; }
.menu-item.danger { color: var(--err); }
.menu-line { height: 1px; margin: 4px 2px; background: var(--border); }

/* The page or the sessions, with the snippets panel beside them. */
.work { flex: 1; min-height: 0; display: flex; }
.work > .page-body, .work > .sessions { flex: 1; min-width: 0; }

/* The page (when no session tab is shown). */
.page-body { flex: 1; min-height: 0; overflow: auto; padding: 20px; }
.page-body > .card { margin: 0 auto; }
.editor-card { max-width: 820px; }
.split-page { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 16px; align-items: start; }
.split-page > .card { margin: 0; }
.dashboard-page { display: flex; flex-direction: column; gap: 12px; }
.dashboard-page h1 { margin: 0; }
.dashboard-page .dash-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.dashboard-page > .card { width: 100%; margin: 0; }
.dash-hosts { padding: 12px 16px; }

/* Signed out: sign-in, two-factor, lock, set-up, in the app's unlock
   dialog (vault_dialogs.rs): a 440 px panel centred on the skin's
   background, the title, the fields, and a footer with the actions. */
.screen {
  height: 100vh; height: 100dvh; overflow: auto; display: flex; flex-direction: column;
  align-items: center; padding: 24px 16px; gap: 16px; background: var(--bg);
}
.screen > * { width: 100%; max-width: 440px; }
.screen > :first-child { margin-top: auto; }
.screen > :last-child { margin-bottom: auto; }
.screen-panel {
  display: flex; flex-direction: column; gap: 14px; padding: 22px;
  background: var(--sidebar); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45); color: var(--text);
}
.screen-panel h1 { font-size: calc(16px * var(--z)); font-weight: 600; margin: 0; }
.screen-panel h2 { font-size: calc(13px * var(--z)); font-weight: 600; margin: 4px 0 0; }
.screen-panel p { margin: 0; }
.screen-panel form { gap: 14px; }
.screen-panel label { font-size: calc(12px * var(--z)); font-weight: 400; color: var(--muted); gap: 6px; }
.screen-panel label.check { color: var(--text); font-size: calc(13px * var(--z)); }
.screen-panel input:not([type=checkbox]) { padding: 8px 12px; border-radius: 7px; color: var(--text); }
.screen-panel button { height: 32px; padding: 0 14px; border-radius: 7px; white-space: nowrap; }
.screen-panel button.primary { font-weight: 600; }
.screen-panel button.secondary { background: var(--card); }
.screen-panel button.secondary:hover { background: var(--input); }
.screen-panel button.ghost { padding: 0 4px; }
.screen-foot {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 4px -22px -22px; padding: 14px 22px; border-top: 1px solid var(--border);
}
.screen-brand { text-align: center; }
.screen-brand .brand { font-size: calc(22px * var(--z)); }
.screen-note { text-align: center; margin: 0; }

.list { display: flex; flex-direction: column; gap: 10px; padding: 12px; }
.list h2 { margin: 4px 4px 0; }
.rows { list-style: none; margin: 0; padding: 0; max-height: 70vh; overflow: auto; }
.row {
  display: flex; flex-direction: column; align-items: flex-start; width: 100%;
  background: transparent; color: var(--text); border: 0; border-radius: 6px;
  padding: 6px 8px; text-align: left;
}
.row:hover { background: var(--hover); }
.row.selected { background: var(--selected); }
.row.folder { flex-direction: row; gap: 6px; font-weight: 600; }
.chev { width: 1em; color: var(--muted); }
.row .name { font-weight: 500; }
.row.d0 { padding-left: 8px; } .row.d1 { padding-left: 24px; } .row.d2 { padding-left: 40px; }
.row.d3 { padding-left: 56px; } .row.d4 { padding-left: 72px; } .row.d5 { padding-left: 88px; }
.row.d6 { padding-left: 104px; } .row.d7 { padding-left: 120px; } .row.d8 { padding-left: 136px; }
.row.host.d0 { padding-left: 24px; } .row.host.d1 { padding-left: 40px; } .row.host.d2 { padding-left: 56px; }
.row.host.d3 { padding-left: 72px; } .row.host.d4 { padding-left: 88px; } .row.host.d5 { padding-left: 104px; }
.row.host.d6 { padding-left: 120px; } .row.host.d7 { padding-left: 136px; } .row.host.d8 { padding-left: 152px; }
.empty { padding: 8px; margin: 0; }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0 0 16px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; white-space: pre-line; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
/* A small form inside another (New folder, New credential in an editor). */
.inline-new {
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px; border: 1px dashed var(--border); border-radius: 8px;
}
button.small { padding: 4px 10px; font-size: calc(13px * var(--z)); }

/* Sessions: split panes, parted by a 1 px line; the views are placed over
   them by the page (positions set through the CSSOM). */
.hidden { display: none !important; }
.sessions { flex: 1; min-height: 0; display: flex; }
.bench { position: relative; flex: 1; min-width: 0; background: var(--border); }
.tabview { position: absolute; display: flex; flex-direction: column; min-height: 0; background: var(--term-bg); }
.tabview > * { flex: 1; min-height: 0; }
.pane-drop { position: absolute; z-index: 4; border: 2px dashed transparent; }
.pane-drop.over { border-color: var(--accent); background: var(--selected); }
.term-wrap { display: flex; flex-direction: column; height: 100%; }
/* content-box: xterm.js's fit reads the parent's computed size as room for
   the rows, which under border-box would include the padding. */
.term { flex: 1; min-height: 0; padding: 14px 18px; background: var(--term-bg); box-sizing: content-box; }
.term-bar {
  display: flex; align-items: center; gap: 8px; padding: 6px 12px;
  border-bottom: 1px solid var(--border); background: var(--card);
}
.term-bar .muted { flex: 1; }

/* Questions while a session starts. */
.overlay {
  position: fixed; inset: 0; background: rgba(0, 0, 0, 0.45);
  display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10;
}
.dialog { max-width: 520px; width: 100%; max-height: 90vh; overflow: auto; }
.dialog p { margin: 0 0 12px; }
.mono { font-family: var(--mono); font-size: calc(12.5px * var(--z)); overflow-wrap: anywhere; }
h2.warn { color: var(--err); }

/* Dialogs, as the apps' (modal.rs): a panel with the title and subtitle,
   tabs, the body, and the footer (secondary action left, Cancel / Save
   right). The width is set per dialog. */
.modal-backdrop { z-index: 20; background: rgba(0, 0, 0, 0.5); }
.confirm-backdrop { z-index: 30; }
/* Two-factor set-up, opened from Settings. */
.over-dialogs { z-index: 25; }
.modal {
  display: flex; flex-direction: column; gap: 0; max-width: 100%;
  max-height: calc(100vh - 48px); max-height: calc(100dvh - 48px);
  background: var(--sidebar); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.45); color: var(--text);
}
.modal:focus { outline: none; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 22px 0; flex: none; }
.modal-title { font-size: calc(16px * var(--z)); font-weight: 600; overflow-wrap: anywhere; }
.modal-subtitle { font-size: calc(12px * var(--z)); color: var(--muted); overflow-wrap: anywhere; }
.modal-tabs {
  display: flex; gap: 4px; padding: 12px 22px 0; flex: none; overflow-x: auto;
  border-bottom: 1px solid var(--border); scrollbar-width: none;
}
.modal-tab {
  background: transparent; border: 0; border-bottom: 2px solid transparent; border-radius: 0;
  padding: 8px 10px; color: var(--muted); white-space: nowrap;
}
.modal-tab:hover { color: var(--text); }
.modal-tab.current { color: var(--text); font-weight: 600; border-bottom-color: var(--accent); }
.modal-body {
  display: flex; flex-direction: column; gap: 16px; padding: 18px 22px;
  flex: 1 1 auto; min-height: 0; overflow-y: auto;
}
/* Switching tabs does not move the dialog; a short window shrinks it. */
.modal-body.fixed { height: 500px; flex-shrink: 1; }
.tab-panel { display: flex; flex-direction: column; gap: 16px; }
.modal-errors { padding: 10px 22px; border-top: 1px solid var(--border); flex: none; }
.modal-foot {
  display: flex; align-items: center; gap: 8px; padding: 14px 22px; flex: none;
  border-top: 1px solid var(--border);
}
.modal button, .confirm button {
  height: 32px; padding: 0 14px; border-radius: 7px; white-space: nowrap;
}
.modal button.primary { font-weight: 600; }
.modal button.secondary { background: var(--card); border-color: var(--border); }
.modal button.secondary:hover { background: var(--input); }
button.ghost { background: transparent; border-color: transparent; color: var(--muted); padding: 0 6px; }
button.ghost:hover { color: var(--text); }
button.ghost.danger-text, .modal button.secondary.danger-text { color: var(--err); }
button.danger-solid { background: var(--err); border-color: var(--err); color: var(--accent-text); font-weight: 600; }
.modal .modal-tab { height: auto; padding: 8px 10px; border-radius: 0; }
.modal label { font-size: calc(12px * var(--z)); font-weight: 400; color: var(--muted); gap: 6px; min-width: 0; }
.modal label.check { color: var(--text); font-size: calc(13px * var(--z)); }
.modal input, .modal select, .modal textarea { color: var(--text); font-size: calc(13px * var(--z)); }
.modal input, .modal select { padding: 8px 12px; border-radius: 7px; }
.modal .mono-input { font-family: var(--mono); font-size: calc(12.5px * var(--z)); }
.field, .field-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-group { gap: 8px; }
.caption { font-size: calc(12px * var(--z)); color: var(--muted); }
p.caption { margin: 0; }
.caption-head { font-size: calc(13px * var(--z)); font-weight: 600; }
.segments {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 3px; width: fit-content; max-width: 100%;
  border-radius: 8px; background: var(--input); border: 1px solid var(--border);
}
.modal .segment, .segment {
  height: 28px; padding: 0 14px; border-radius: 6px; border: 1px solid transparent;
  background: transparent; color: var(--muted); white-space: nowrap; font-weight: 400;
}
.segment:hover:not(:disabled) { color: var(--text); }
.segment.current { background: var(--selected); border-color: var(--accent); color: var(--text); font-weight: 600; }
.segment:disabled { opacity: 0.45; cursor: not-allowed; }
.inherit-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  border-radius: 9px; background: var(--card); border: 1px solid var(--border);
}
.card-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.card-title { font-weight: 600; }
.inherit-card button.ghost { font-size: calc(12px * var(--z)); }
.with-button { display: flex; align-items: flex-end; gap: 8px; }
.with-button label { flex: 1; }
.modal .inline-new { background: var(--card); }
.modal .notices li { background: var(--card); }
.pill-ws {
  padding: 3px 12px; border-radius: 7px; border: 1px solid var(--accent);
  background: var(--selected); font-size: calc(12.5px * var(--z)); font-weight: 500;
}
.table-frame { border: 1px solid var(--border); border-radius: 10px; overflow: auto; }
.cred-table { width: 100%; border-collapse: collapse; }
.cred-table th {
  text-align: left; font-size: calc(11.5px * var(--z)); font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.03em; padding: 10px 14px; background: var(--card);
}
.cred-table td { padding: 10px 14px; border-top: 1px solid var(--border); }
.cred-table td.strong { font-weight: 600; }
.cred-row { cursor: pointer; }
.cred-row:hover td, .cred-row:focus-visible td { background: var(--hover); }
.cred-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.modal.confirm { width: 400px; }
.confirm-text { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.confirm-body { margin: 0; color: var(--muted); white-space: pre-line; }
@media (max-width: 700px) {
  .overlay.modal-backdrop { padding: 8px; }
  .modal { max-height: calc(100dvh - 16px); }
  .modal-body.fixed { height: auto; }
  .modal-head, .modal-body, .modal-foot { padding-left: 14px; padding-right: 14px; }
  .modal-tabs { padding-left: 14px; padding-right: 14px; }
  .cred-table th:nth-child(2), .cred-table td:nth-child(2) { display: none; }
}

/* Sections of the list, editors (W4). */
.segs { display: flex; flex-wrap: wrap; gap: 2px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; }
.seg {
  flex: 1; background: transparent; color: var(--text); border: 0; border-radius: 6px;
  padding: 5px 6px; font-size: calc(13px * var(--z)); display: inline-flex; justify-content: center; gap: 6px;
}
.seg.current { background: var(--selected); font-weight: 600; }
.badge {
  min-width: 18px; padding: 0 5px; border-radius: 999px; font-size: calc(11px * var(--z)); line-height: 18px;
  background: var(--err); color: var(--bg); text-align: center;
}
.tag-server {
  margin-left: 6px; padding: 0 5px; border-radius: 4px; font-size: calc(10.5px * var(--z)); font-weight: 500;
  border: 1px solid var(--accent); color: var(--accent); vertical-align: 1px;
}
.running-list { margin-top: 14px; border-top: 1px solid var(--border); padding-top: 8px; }
.running-list h3 { font-size: calc(13px * var(--z)); margin: 4px 0 6px; }
.running { display: flex; flex-direction: column; gap: 2px; padding: 6px 4px; }
.running .actions { display: flex; gap: 6px; margin-top: 4px; }
.running .actions button { padding: 3px 9px; font-size: calc(12.5px * var(--z)); }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar button { padding: 5px 10px; font-size: calc(13px * var(--z)); }
.folder-line { display: flex; align-items: center; }
.folder-line .row { flex: 1; min-width: 0; }
button.icon {
  background: transparent; border: 0; color: var(--muted); padding: 4px 8px; visibility: hidden;
}
.folder-line:hover button.icon, button.icon:focus-visible { visibility: visible; }
@media (hover: none) { button.icon { visibility: visible; } }
button.icon:hover { color: var(--accent); }
button.danger { background: transparent; color: var(--err); border-color: var(--err); }
.actions .spacer { flex: 1; }
.err { color: var(--err); margin: 0; }
p.ok { color: var(--ok); margin: 0; }
.account-form { display: grid; gap: 0.5rem; margin-bottom: 0.5rem; }
h3 { font-size: calc(15px * var(--z)); margin: 20px 0 8px; }
.editor h3 { margin-top: 0; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px 12px; margin: 0; display: flex; flex-direction: column; gap: 10px; }
legend { font-weight: 600; font-size: calc(13px * var(--z)); color: var(--muted); padding: 0 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2.wide-first { grid-template-columns: 1fr 120px; }
@media (max-width: 520px) { .row2, .row2.wide-first { grid-template-columns: 1fr; } }
textarea {
  font: inherit; color: inherit; background: var(--input); width: 100%; resize: vertical;
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
}
textarea.mono { font-family: var(--mono); font-size: calc(12px * var(--z)); }
textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
label.file input { padding: 4px; }
/* Import SSH config: one row per host, as in the app. */
.config-rows {
  list-style: none; margin: 0; padding: 0; max-height: 340px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: 8px;
}
.config-row { display: flex; align-items: center; gap: 10px; padding: 7px 12px; }
.config-row + .config-row { border-top: 1px solid var(--border); }
.config-row label.check { flex: 1; min-width: 0; align-items: flex-start; }
.config-row label.check input { margin-top: 3px; }
.config-host { display: flex; flex-direction: column; min-width: 0; }
.config-line { display: flex; gap: 8px; min-width: 0; }
.config-line .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; overflow-wrap: normal; }
.config-found { margin: 0; }
.setting-buttons { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.backup-list { margin: 0; padding-left: 18px; }
.notices { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notices li {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between;
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}

/* Files tabs, as the app's (files.rs): the toolbar, the navigation row,
   the folder tree (230 px) and the list; the transfers under them. */
.files-wrap { display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }
.files-connecting { padding: 16px; margin: 0; }
.files-tools {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; flex: none;
  border-bottom: 1px solid var(--border); background: var(--sidebar);
}
.files-tools button { height: 28px; padding: 0 12px; border-radius: 7px; }
.files-tools button.secondary { background: var(--card); border-color: var(--border); }
.files-tools button:disabled { opacity: 0.45; cursor: default; }
.files-tools button.danger-text { color: var(--err); }
.files-nav {
  display: flex; align-items: center; gap: 6px; padding: 6px 10px; flex: none;
  border-bottom: 1px solid var(--border);
}
.files-host { display: flex; align-items: center; gap: 6px; font-weight: 600; white-space: nowrap; flex: none; }
.files-nav .icon-btn { width: 28px; height: 28px; flex: none; font-size: calc(16px * var(--z)); }
.files-nav .icon-btn:disabled { opacity: 0.35; cursor: default; }
.files-nav .tree-toggle.on { color: var(--accent); }
.files-nav .crumbs, .files-nav .path { flex: 1; min-width: 0; }
.crumbs {
  display: flex; align-items: center; height: 30px; padding: 0 6px; overflow: hidden;
  border-radius: 7px; background: var(--input); border: 1px solid var(--border);
  font-size: calc(12.5px * var(--z));
}
.crumb {
  flex: none; background: transparent; border: 0; color: var(--text); padding: 2px 5px;
  border-radius: 4px; font: inherit;
}
.crumb:hover { background: var(--border); }
.crumb-sep { color: var(--muted); padding: 0 2px; }
.crumb-edit { flex: 1; align-self: stretch; background: transparent; border: 0; cursor: text; min-width: 20px; }
.files-nav .path input { height: 30px; padding: 0 10px; font-size: calc(12.5px * var(--z)); }
.files-search { width: 180px; flex: none; height: 30px; padding: 0 10px; }
.files-sort { width: 140px; flex: none; height: 30px; padding: 0 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
label.check { flex-direction: row; align-items: center; gap: 6px; font-weight: 400; }
label.check input { width: auto; }
button.link {
  background: transparent; border: 0; color: var(--accent); padding: 2px 4px; text-align: left;
}
button.link:hover { text-decoration: underline; }
.files-main { display: flex; flex: 1; min-height: 0; }
.tree {
  width: 230px; flex: none; overflow: auto; padding: 6px 4px;
  border-right: 1px solid var(--border); background: var(--sidebar);
}
.tree-head {
  display: block; padding: 0 8px 4px; font-size: calc(11px * var(--z)); font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.tree .folder-line { height: 26px; border-radius: 5px; }
.tree .row.folder {
  display: flex; align-items: center; gap: 0; padding: 0 6px; height: 26px; font-weight: 400;
  background: transparent; border: 0; border-radius: 5px; color: var(--text); text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tree .row.folder:hover { background: var(--hover); }
.tree .row.folder.selected { background: var(--selected); font-weight: 600; }
.chev-btn {
  background: transparent; border: 0; color: var(--muted); padding: 0 2px; width: 14px; flex: none;
  font-size: calc(10px * var(--z));
}
.chev-btn.d1 { margin-left: 14px; } .chev-btn.d2 { margin-left: 28px; }
.chev-btn.d3 { margin-left: 42px; } .chev-btn.d4 { margin-left: 56px; }
.chev-btn.d5 { margin-left: 70px; } .chev-btn.d6 { margin-left: 84px; }
.chev-btn.d7 { margin-left: 98px; } .chev-btn.d8 { margin-left: 112px; }
.listing { flex: 1; min-width: 0; overflow: auto; display: flex; flex-direction: column; border: 2px solid transparent; }
.listing.dropping { border-color: var(--accent); border-style: dashed; background: var(--selected); }
.listing > .err, .listing > .muted { margin: 8px 12px 0; }
.naming { gap: 8px; margin: 10px 12px 0; border: 1px solid var(--border); border-radius: 8px; padding: 10px; }
.ftable { width: 100%; border-collapse: collapse; table-layout: fixed; }
.ftable th {
  text-align: left; font-weight: 500; color: var(--muted); padding: 5px 12px; position: sticky; top: 0;
  font-size: calc(11.5px * var(--z)); background: var(--bg); border-bottom: 1px solid var(--border);
}
.ftable th:nth-child(2) { width: 72px; } .ftable th:nth-child(3) { width: 150px; } .ftable th:nth-child(4) { width: 100px; }
.ftable td { height: 28px; padding: 0 12px; vertical-align: middle; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow { cursor: default; user-select: none; }
.frow:hover td { background: var(--hover); }
.frow.selected td { background: var(--selected); }
.ftable .num { text-align: right; }
.fname-text { overflow: hidden; text-overflow: ellipsis; }
.ficon {
  display: inline-block; margin-right: 8px; vertical-align: -1px; border-radius: 2px; flex: none;
}
.ficon.folder { width: 14px; height: 11px; background: var(--accent); opacity: 0.75; }
.ficon.file { width: 9px; height: 12px; border: 1.5px solid var(--muted); }
.files-status {
  flex: none; padding: 5px 12px; color: var(--muted); border-top: 1px solid var(--border);
  font-size: calc(11.5px * var(--z));
}
.transfers { flex: none; max-height: 40%; overflow: auto; padding: 10px 14px; border-top: 1px solid var(--border); background: var(--sidebar); }
.transfers-head { display: flex; align-items: center; gap: 12px; }
.transfers-head h3 { margin: 0; font-size: calc(13px * var(--z)); }
.transfers-head button { padding: 4px 10px; font-size: calc(12.5px * var(--z)); }
.transfer-rows { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.transfer-rows li {
  display: grid; grid-template-columns: minmax(120px, 1fr) 180px minmax(120px, 1fr) auto;
  gap: 10px; align-items: center; font-size: calc(12.5px * var(--z));
}
.transfer-rows .tname { overflow-wrap: anywhere; }
.transfer-rows progress { width: 100%; accent-color: var(--accent); }
.transfer-rows button { padding: 2px 8px; font-size: calc(12px * var(--z)); }

/* The snippets panel, as the app's: 250 px, the section header with the
   terminal's device type and +, "Send to", and a card per snippet. */
.snippets {
  width: 250px; flex: none; padding: 12px; display: flex; flex-direction: column; gap: 10px;
  overflow: auto; border-left: 1px solid var(--border); background: var(--sidebar);
}
.snippets-head { display: flex; align-items: center; gap: 6px; }
.section-head {
  font-size: calc(11px * var(--z)); font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.04em;
}
.snippets-profile { font-size: calc(11.5px * var(--z)); color: var(--muted); }
.snippets .new-snippet { width: 24px; height: 24px; border-radius: 6px; color: var(--muted); }
.snippets .new-snippet:hover { background: var(--input); color: var(--text); }
.snippets .segments.send-to { width: 100%; }
.snippets .segment { flex: 1; padding: 0 4px; font-size: calc(11.5px * var(--z)); }
.snippets .cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.snippet {
  display: flex; flex-direction: column; gap: 6px; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--card);
}
.snippet-head { display: flex; align-items: center; gap: 6px; }
.snippet-head .name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.snippet-head .snippet-menu { padding: 0 4px; visibility: hidden; }
.snippet:hover .snippet-menu, .snippet-menu:focus-visible { visibility: visible; }
@media (hover: none) { .snippet-head .snippet-menu { visibility: visible; } }
.snippet-head .snippet-send { height: 24px; padding: 0 10px; font-size: calc(11.5px * var(--z)); border-radius: 6px; }
.snippet-body {
  display: flex; flex-direction: column; gap: 1px; overflow: hidden; color: var(--muted);
  font-family: var(--mono); font-size: calc(11.5px * var(--z));
}
.snippet-body > div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.snippet-asks { font-size: calc(11.5px * var(--z)); color: var(--muted); }
.snippets .show-all { font-size: calc(11.5px * var(--z)); padding: 0; }
.snippets-toast { margin: 0; padding: 6px 10px; border-radius: 6px; background: var(--selected); font-size: calc(12px * var(--z)); }
.vars { gap: 8px; border: 1px solid var(--accent); border-radius: 8px; padding: 10px; }
@media (max-width: 900px) { .snippets { width: 220px; } }

/* The extra-keys row under a terminal on a phone (W7). */
.extra-keys {
  display: flex; gap: 4px; overflow-x: auto; flex: none; padding: 2px 0;
  scrollbar-width: none; touch-action: pan-x;
}
.extra-keys .key {
  flex: none; min-width: 42px; height: 38px; padding: 0 10px; border-radius: 6px;
  font-family: var(--mono); font-size: calc(14px * var(--z));
  background: var(--hover); color: var(--text); border: 1px solid var(--border);
}
.extra-keys .key.on { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.extra-keys .key.held { box-shadow: inset 0 -3px 0 var(--accent-text); }

/* Phones (W7): one pane at a time (the page draws only the focused one),
   the snippets panel as a sheet over the sessions, and room for the
   keyboard (the viewport shrinks with it: see index.html). */
@media (max-width: 700px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; z-index: 30; width: min(300px, 86vw);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.35);
  }
  .side-backdrop { position: fixed; inset: 0; z-index: 29; background: rgba(0, 0, 0, 0.4); }
  .titlebar { padding: 0 4px; }
  .snippets-toggle .snippets-label { display: none; }
  .page-body { padding: 10px; }
  .split-page { grid-template-columns: 1fr; }
  .dashboard-page .dash-cards { grid-template-columns: 1fr 1fr; }
  .statusbar { gap: 10px; padding: 0 10px; }
  .term { padding: 4px; }
  .snippets {
    position: fixed; left: 8px; right: 8px; bottom: 8px; width: auto; height: 60dvh;
    z-index: 5; box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.35);
  }
  .rows { max-height: none; }
  .transfer-rows li { grid-template-columns: 1fr auto; }
  .transfer-rows li > :nth-child(2), .transfer-rows li > :nth-child(3) { grid-column: 1 / -1; }
  .files-main { flex-direction: column; }
  .tree { width: auto; max-height: 30vh; border-right: 0; border-bottom: 1px solid var(--border); }
  .files-nav { flex-wrap: wrap; }
  .files-search, .files-sort { width: auto; flex: 1; }
  .files-host { display: none; }
}
}

/* Passkeys (W7). */
.passkey-signin { display: flex; flex-direction: column; gap: 6px; margin: 0 0 12px; }
.passkey-signin p { margin: 0; }
button.passkey-unlock { width: 100%; margin: 0 0 12px; }
.kept-list .tunnels { list-style: none; margin: 2px 0 0; padding: 0 0 0 10px; }
.kept-list .tunnel { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: calc(12.5px * var(--z)); }
.kept-list .tunnel button { padding: 2px 8px; font-size: calc(12px * var(--z)); }
.kept-list .actions input { min-width: 0; flex: 1; font-size: calc(12.5px * var(--z)); }
.kept-list .run-output { max-height: 240px; overflow: auto; margin: 4px 0; padding: 6px 8px; font-size: calc(12px * var(--z)); white-space: pre-wrap; background: var(--bg-input, rgba(127,127,127,.08)); border-radius: 6px; }
.schedule-form { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; padding: 10px; border: 1px solid var(--border); border-radius: 8px; }
.schedule-form h4 { margin: 0; font-size: calc(13px * var(--z)); }
.schedule-form label { display: flex; flex-direction: column; gap: 3px; font-size: calc(12.5px * var(--z)); }
.schedule-form label.check { flex-direction: row; align-items: center; gap: 6px; }
.schedule-form .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Dashboard and host metrics, from the server's monitoring. */
.dash-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dash-card {
  display: flex; flex-direction: column; padding: 10px 12px;
  border: 1px solid var(--border); border-radius: 8px;
}
.dash-card .num { font-size: calc(20px * var(--z)); font-weight: 600; }
.pill {
  display: inline-block; font-size: calc(12px * var(--z)); padding: 1px 8px; border-radius: 999px;
  border: 1px solid currentColor; white-space: nowrap;
}
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.err { color: var(--err); }
.table-wrap { overflow-x: auto; }
.dash-table { width: 100%; border-collapse: collapse; font-size: calc(14px * var(--z)); }
.dash-table th {
  text-align: left; font-weight: 600; font-size: calc(12px * var(--z)); color: var(--muted);
  padding: 6px 8px; border-bottom: 1px solid var(--border);
}
.dash-table td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
.dash-row { cursor: pointer; }
.dash-row:hover { background: var(--hover); }
.dash-row button.link { padding: 0; font-weight: 500; color: var(--text); }
td.metric { white-space: nowrap; }
.meter {
  display: inline-block; width: 56px; height: 6px; border-radius: 3px; vertical-align: middle;
  background: var(--border); overflow: hidden; margin-right: 6px;
}
.meter .fill { display: block; height: 100%; }
.meter .fill.ok { background: var(--ok); }
.meter .fill.warn { background: var(--warn); }
.meter .fill.err { background: var(--err); }
.metric .num { font-size: calc(13px * var(--z)); }
@media (max-width: 720px) { .hide-narrow { display: none; } .meter { width: 32px; } }
.metrics-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.metrics-head h2 { margin: 0; }
.status-line { display: flex; align-items: center; gap: 10px; }
.seg-row {
  display: inline-flex; gap: 2px; padding: 2px; margin: 4px 0 12px;
  border: 1px solid var(--border); border-radius: 8px;
}
.graphs { display: flex; flex-direction: column; gap: 12px; }
.graph { border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; }
.graph-head { display: flex; justify-content: space-between; font-size: calc(13px * var(--z)); font-weight: 600; }
.graph svg { display: block; width: 100%; height: 90px; }
.graph .line {
  fill: none; stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke;
  stroke-linejoin: round;
}
.graph .grid { stroke: var(--border); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.graph p { margin: 4px 0 0; }

/* First set-up and two-factor (join.rs). */
.recovery-key { padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: calc(15px * var(--z)); letter-spacing: 0.04em; user-select: all; }
img.qr { display: block; width: 200px; height: 200px; margin: 0 0 12px; image-rendering: pixelated; border-radius: 6px; }
ul.codes { list-style: none; margin: 0 0 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; columns: 2; user-select: all; }

/* The sign-in animation over the page (welcome.rs). Placeholders for phase 3c,
   which brings the real Molten pour and Torn open; same ids and lengths. A
   click ends it; reduced motion never shows it. */
.signin-anim { position: fixed; inset: 0; z-index: 100; overflow: hidden; cursor: pointer; }
.signin-anim .layer { position: absolute; top: 0; bottom: 0; animation-fill-mode: forwards; }
.anim-molten_pour .layer.one {
  left: 0; right: 0;
  background: linear-gradient(180deg, #ffd27a 0%, #f08a2c 35%, #c8401c 70%, #5c1408 100%);
  animation: molten-drain 1.6s cubic-bezier(.55, 0, .35, 1) forwards;
}
.anim-molten_pour .layer.two {
  left: 0; right: 0; height: 18%; top: auto;
  background: radial-gradient(120% 100% at 50% 100%, #fff1b8cc, #ffb34700 70%);
  animation: molten-glow 1.6s ease-in forwards;
}
@keyframes molten-drain {
  0%, 20% { clip-path: inset(0 0 0 0); }
  100% { clip-path: inset(100% 0 0 0); }
}
@keyframes molten-glow {
  0%, 20% { opacity: 1; transform: translateY(-460%); }
  100% { opacity: 0; transform: translateY(0); }
}
.anim-torn_open .layer {
  left: 0; right: 0;
  background: linear-gradient(160deg, #4a3a2e, #241c16);
  animation-duration: 1.4s; animation-timing-function: cubic-bezier(.7, 0, .3, 1);
}
/* Both halves share one seam, so the cover is whole until it tears. */
.anim-torn_open .layer.one {
  clip-path: polygon(0 0, 50% 0, 47% 9%, 53% 18%, 46% 30%, 52% 41%, 45% 53%, 53% 64%, 47% 76%, 54% 88%, 49% 100%, 0 100%);
  animation-name: torn-left;
}
.anim-torn_open .layer.two {
  clip-path: polygon(50% 0, 47% 9%, 53% 18%, 46% 30%, 52% 41%, 45% 53%, 53% 64%, 47% 76%, 54% 88%, 49% 100%, 100% 100%, 100% 0);
  animation-name: torn-right;
}
@keyframes torn-left { 0%, 18% { transform: none; } 100% { transform: translateX(-60%) rotate(-4deg); } }
@keyframes torn-right { 0%, 18% { transform: none; } 100% { transform: translateX(60%) rotate(4deg); } }
@media (prefers-reduced-motion: reduce) { .signin-anim { display: none; } }

/* The server's sections of Settings (admins only). */
.admin { display: flex; flex-direction: column; gap: 12px; }
.admin > p { margin: 0; }
.admin-part { display: flex; flex-direction: column; gap: 12px; }
.admin-part h3 { margin: 8px 0 0; font-size: calc(16px * var(--z)); }
.admin-part p { margin: 0; }
.setting .muted { margin: 2px 0 0 24px; }
.banner.warn { color: var(--warn); border: 1px solid var(--warn); }
.banner.ok { color: var(--ok); border: 1px solid var(--ok); }
.banner.warn button { margin-left: 8px; }
.row-fields { display: flex; gap: 12px; flex-wrap: wrap; }
.row-fields label { flex: 1; min-width: 140px; }
.users tr.off td { color: var(--muted); }
.users .actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }
.users .actions-cell button, .admin-part td button { padding: 3px 9px; font-size: calc(12.5px * var(--z)); }
.invite { display: flex; flex-direction: column; gap: 8px; }
.backup-form { max-width: 640px; }
button.secondary.current { background: var(--selected); }

/* Settings (settings.rs), as the app's: the menu on the left, rows with
   the label and its explanation on the left and the control on the right. */
.modal.settings { width: 980px; }
.settings-main { display: flex; flex: 1 1 auto; min-height: 0; height: 560px; border-top: 1px solid var(--border); margin-top: 14px; }
.settings-nav {
  width: 190px; flex: none; display: flex; flex-direction: column; gap: 2px;
  padding: 10px 8px; border-right: 1px solid var(--border); overflow-y: auto;
}
.modal .settings-item {
  height: auto; padding: 6px 10px; border-radius: 6px; border: 0; text-align: left;
  background: transparent; color: var(--text); font-weight: 400;
}
.modal .settings-item:hover { background: var(--hover); }
.modal .settings-item.current { background: var(--selected); font-weight: 600; }
.settings-group {
  margin: 12px 10px 4px; font-size: calc(11px * var(--z)); font-weight: 600;
  color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em;
}
.settings-body {
  flex: 1; min-width: 0; overflow-y: auto; padding: 8px 22px 18px;
  display: flex; flex-direction: column; gap: 0;
}
.settings-heading { font-size: calc(15px * var(--z)); font-weight: 600; margin: 10px 0 6px; }
.settings-sub { font-size: calc(14px * var(--z)); font-weight: 600; margin: 18px 0 4px; }
.setting-row {
  display: flex; align-items: center; gap: 18px; padding: 10px 0;
  border-bottom: 1px solid var(--border);
}
.setting-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.setting-label { font-weight: 500; }
.setting-control { width: 340px; flex: none; display: flex; justify-content: flex-end; }
.setting-control select { width: 100%; }
.setting-control .with-button { display: flex; gap: 8px; width: 100%; }
.setting-control .with-button select { flex: 1; min-width: 0; }
.setting-control .segments.skins { width: 100%; justify-content: flex-start; }
.setting-more {
  display: flex; flex-direction: column; gap: 10px; padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.setting-more form, .account-form { display: flex; flex-direction: column; gap: 10px; max-width: 420px; }
.settings-note { margin: 12px 0 0; }
.settings-body .err, .settings-body .ok { margin: 8px 0 0; }
.ws-defaults { display: flex; flex-direction: column; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.ws-defaults .modal-tabs { padding: 0; }
.ws-defaults .actions { display: flex; align-items: center; gap: 10px; }
.settings-body .field-group { padding: 14px 0; border-bottom: 1px solid var(--border); }
.settings-body .admin table { width: 100%; }
@media (max-width: 700px) {
  .modal.settings { width: 100%; }
  .settings-main { flex-direction: column; height: auto; }
  .settings-nav {
    width: auto; flex-direction: row; overflow-x: auto; border-right: 0;
    border-bottom: 1px solid var(--border); scrollbar-width: none;
  }
  .modal .settings-item { white-space: nowrap; }
  .settings-group { margin: 6px 4px 0 10px; align-self: center; }
  .setting-row { flex-direction: column; align-items: stretch; gap: 8px; }
  .setting-control { width: auto; justify-content: flex-start; }
}

/* The skin's variants, as the app's chrome.rs draws them: `data-*` on the
   page's root (look.rs) picks the tab shape, buttons, section headers,
   title, window frame, status dots, terminal frame and snippet cards. The
   plain values draw nothing extra. */

/* Tabs: a tombstone arch, a brass-edged tag, a gold connector finger. */
[data-tab=arched] .tab { border-radius: 16px 16px 0 0; }
[data-tab=tag] .tab { border-radius: 9px 9px 0 0; }
[data-tab=connector] .tab { border-radius: 3px 3px 0 0; }
[data-tab=connector] .tab.current {
  background: linear-gradient(180deg, var(--gold), var(--gold-dark)); border-color: var(--gold);
  color: var(--accent-text); font-weight: 700;
}
[data-tab=connector] .tab.current :is(.tab-glyph, .tab-close, .tab-badge) { color: var(--accent-text); }
[data-tab=connector] .tab.current .dot { box-shadow: 0 0 0 1.5px var(--accent-text); }

/* Primary buttons: a brass pill, a gold connector, red wax. Snippets send
   with them too, as the app's cards do in decorated skins. */
[data-button=pill] :is(button.primary, .snippet-send) {
  border-radius: 999px; border-color: transparent; color: var(--accent-text); font-weight: 600;
  background: linear-gradient(180deg, var(--brass-light), var(--brass));
}
[data-button=connector] :is(button.primary, .snippet-send) {
  border-radius: 3px; border-color: var(--gold); color: var(--accent-text); font-weight: 600;
  background: linear-gradient(180deg, var(--gold), var(--gold-dark));
}
[data-button=seal] :is(button.primary, .snippet-send) {
  border-radius: 999px; border-color: transparent; color: var(--accent-text); font-weight: 600;
  background: linear-gradient(160deg, var(--blood), var(--blood-dark));
}

/* Section headers (the sidebar's workspaces, the snippets panel): an
   engraved brass plaque, or blackletter. */
[data-section=plaque] :is(.section-head, .ws-name) {
  flex: 0 1 auto; padding: 1px 8px; border-radius: 3px; border: 1px solid var(--brass-dark);
  background: linear-gradient(180deg, var(--brass-light), var(--brass));
  font-family: var(--display); font-size: calc(10.5px * var(--z)); font-weight: 700;
  color: var(--accent-text); text-transform: uppercase;
}
[data-section=plaque] .ws-head .plus { margin-left: auto; }
[data-section=blackletter] :is(.section-head, .ws-head) {
  font-family: var(--display); font-size: calc(19px * var(--z)); font-weight: 400;
  color: var(--text); text-transform: none; letter-spacing: 0;
}

/* The app's name: an engraved nameplate between gears, blackletter between
   skulls, or a silkscreened board label. */
[data-title=nameplate] .brand {
  font-family: var(--display); font-size: calc(15px * var(--z)); color: var(--brass-light);
  text-transform: uppercase; letter-spacing: 0.35em;
}
[data-title=nameplate] .brand::before, [data-title=nameplate] .brand::after {
  content: "\2699"; color: var(--brass); letter-spacing: 0; margin: 0 8px;
}
[data-title=blackletter] .brand { font-family: var(--display); font-size: calc(22px * var(--z)); font-weight: 400; }
[data-title=blackletter] .brand::before, [data-title=blackletter] .brand::after {
  content: "\2620"; font-family: var(--ui); font-size: calc(14px * var(--z)); margin: 0 8px;
}
[data-title=silkscreen] .brand {
  font-family: var(--mono); font-size: calc(10.5px * var(--z)); font-weight: 400;
  color: var(--trace); text-transform: uppercase; white-space: nowrap;
}
[data-title=silkscreen] .brand::after { content: " \00b7  " var(--skin-name, ""); }

/* The window's frame: a brass border; a blood line with drips under the
   title bar; gold lines under the title bar and above the status bar. */
[data-frame=brass] .window.signed-in {
  border: 3px solid; border-image: linear-gradient(135deg, var(--brass-light), var(--brass-dark)) 1;
}
[data-frame=drips] .titlebar { position: relative; border-bottom-color: var(--blood); }
[data-frame=drips] .titlebar::after {
  content: ""; position: absolute; left: 0; right: 0; top: calc(100% - 1px); height: 21px;
  pointer-events: none; z-index: 3;
  background:
    linear-gradient(var(--blood), var(--blood)) 0 0 / 100% 2px no-repeat,
    linear-gradient(var(--blood), var(--blood-dark)) 6% 0 / 4px 10px no-repeat,
    linear-gradient(var(--blood), var(--blood-dark)) 14% 0 / 5px 17px no-repeat,
    linear-gradient(var(--blood), var(--blood-dark)) 27% 0 / 3px 8px no-repeat,
    linear-gradient(var(--blood), var(--blood-dark)) 38% 0 / 4px 13px no-repeat,
    linear-gradient(var(--blood), var(--blood-dark)) 52% 0 / 5px 21px no-repeat,
    linear-gradient(var(--blood), var(--blood-dark)) 63% 0 / 3px 9px no-repeat,
    linear-gradient(var(--blood), var(--blood-dark)) 74% 0 / 4px 15px no-repeat,
    linear-gradient(var(--blood), var(--blood-dark)) 86% 0 / 4px 11px no-repeat,
    linear-gradient(var(--blood), var(--blood-dark)) 95% 0 / 5px 19px no-repeat;
}
[data-frame=circuit] .titlebar { border-bottom-color: var(--trace); }
[data-frame=circuit] .statusbar { border-top-color: var(--trace); }

/* Status dots: an amber bulb, a small flame, a solder pad. */
[data-dot=bulb] .dot {
  width: 9px; height: 9px; background: linear-gradient(160deg, var(--brass-light), var(--c) 70%);
  box-shadow: 0 0 6px var(--c);
}
[data-dot=candle] .dot {
  width: 6px; height: 11px; border-radius: 50% 50% 7px 7px / 60% 60% 40% 40%;
  background: linear-gradient(180deg, var(--ember), var(--c)); box-shadow: 0 0 5px var(--glow);
}
[data-dot=pad] .dot {
  width: 10px; height: 10px; border-radius: 2px; padding: 1.5px; border: 1px solid var(--c);
  background: var(--c); background-clip: content-box;
}

/* The terminal's frame: a brass porthole bezel, a dark mirror with a red
   glow, a gold component outline. On the terminal's wrapper, as xterm.js
   sizes the terminal from its own box. */
[data-term-frame=porthole] .term-wrap {
  margin: 10px; height: calc(100% - 20px); padding: 4px; border-radius: 6px; overflow: hidden;
  background: linear-gradient(135deg, var(--brass-light), var(--brass-dark));
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
}
[data-term-frame=porthole] .term-wrap > :first-child { border-radius: 3px 3px 0 0; }
[data-term-frame=porthole] .term-wrap > .term { border-radius: 0 0 3px 3px; }
[data-term-frame=porthole] .term-wrap > .term:first-child { border-radius: 3px; }
[data-term-frame=mirror] .term-wrap {
  margin: 10px; height: calc(100% - 20px); border-radius: 4px; overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--blood) 55%, transparent);
  box-shadow: 0 0 14px color-mix(in srgb, var(--blood) 35%, transparent);
}
[data-term-frame=component] .term-wrap {
  margin: 15px; height: calc(100% - 30px); border-radius: 3px; border: 1px solid var(--border);
  outline: 1px solid var(--trace); outline-offset: 3px;
}

/* Snippet cards: ruled parchment, dark stone. */
[data-card=index_card] .snippet {
  border-radius: 2px; border-color: var(--brass-dark); color: var(--parchment-text);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.5);
  background:
    repeating-linear-gradient(180deg, transparent 0 17px, color-mix(in srgb, var(--brass) 25%, transparent) 17px 18px) 0 13px / 100% calc(100% - 13px) no-repeat,
    var(--parchment);
}
[data-card=index_card] :is(.snippet-body, .snippet-asks, .snippet-menu) {
  color: color-mix(in srgb, var(--parchment-text) 80%, transparent);
}
[data-card=slab] .snippet { border-radius: 3px; background: linear-gradient(180deg, var(--card), var(--bg)); }
.content > .banner button.fix { flex: none; white-space: nowrap; padding: 3px 10px; }
/* The host editor's custom SSH algorithm set, as in the app. */
.alg-set { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.alg-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px 16px; }
.alg-group { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.alg-group legend {
  padding: 0; margin-bottom: 4px; font-size: calc(11px * var(--z)); font-weight: 600;
  text-transform: uppercase; color: var(--muted);
}
.modal .alg-set label.check.muted { color: var(--muted); }
.alg-set .mono { font-size: calc(12px * var(--z)); overflow-wrap: anywhere; }
.host-tunnels { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.host-tunnels .tunnel { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.host-tunnels .tunnel button { margin-left: auto; padding: 3px 10px; }
.new-tunnel { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.new-tunnel input { flex: 1; min-width: 0; }
.new-tunnel button { flex: none; }
.tunnel-error { color: var(--err); margin: 6px 0 0; }

/* The Discovery tab: the scan bar, the inventory bar, the table grouped
   by subnet beside the details, and the scheduled scans. */
.discovery-page { display: flex; flex-direction: column; gap: 14px; }
.discovery-page h1 { margin: 0; }
.discovery-page > .card { margin: 0; }
.disc-scan, .disc-inventory, .disc-schedules { display: flex; flex-direction: column; gap: 10px; }
.disc-scan .bridge-note { margin: 0; }
.disc-scan-form {
  display: grid; gap: 10px; align-items: end;
  grid-template-columns: minmax(180px, 1fr) minmax(200px, 1.4fr) minmax(120px, 0.8fr) minmax(140px, 0.8fr) auto;
}
.disc-go { flex-wrap: nowrap; }
.disc-progress { display: flex; align-items: center; gap: 8px; }
.disc-progress .meter { width: 160px; }
.disc-lines { margin: 0; padding-left: 18px; }
.disc-inventory { flex-direction: row; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.disc-inventory .spacer { flex: 1; }
.disc-inventory .field { min-width: 220px; }
.disc-inventory .disc-filter { min-width: 200px; }
.disc-main { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.disc-table-card { padding: 0; overflow: hidden; }
.disc-empty { padding: 16px; margin: 0; }
.disc-table { width: 100%; border-collapse: collapse; font-size: calc(13px * var(--z)); }
.disc-table th {
  text-align: left; font-weight: 600; color: var(--muted); padding: 0; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.disc-table th button.sort {
  background: transparent; border: 0; color: inherit; font-weight: 600; padding: 8px; width: 100%;
  text-align: left; border-radius: 0;
}
.disc-table th button.sort:hover { color: var(--text); background: var(--hover); }
.disc-table td {
  padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 220px; vertical-align: middle;
}
.disc-table tr.disc-group th {
  padding: 10px 8px 6px; color: var(--text); background: var(--hover); font-size: calc(12px * var(--z));
}
.disc-row { cursor: pointer; }
.disc-row:hover { background: var(--hover); }
.disc-row.current { background: var(--selected); }
.disc-row.gone td { color: var(--muted); }
.disc-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.disc-table .col-status { width: 70px; }
.disc-table .col-status .dot { margin-right: 6px; }
.dot.off { --c: var(--border); }
.disc-table .col-name .known { display: block; }
.disc-badge { font-size: calc(11px * var(--z)); padding: 0 6px; }
.disc-badge.new { color: var(--ok); }
.disc-badge.changed { color: var(--warn); }
.disc-badge.gone { color: var(--muted); }
.disc-details { position: sticky; top: 0; display: flex; flex-direction: column; gap: 10px; }
.disc-details h2 { margin: 0; overflow-wrap: anywhere; }
.disc-details > p { margin: 0; }
.disc-known { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
.disc-actions a.button {
  display: inline-block; text-decoration: none; border-radius: 6px; padding: 6px 14px;
  border: 1px solid var(--border); color: var(--text); max-width: 100%; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap;
}
.disc-actions a.button:hover { background: var(--hover); }
.disc-lines-list {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 4px 10px; margin: 0;
  font-size: calc(13px * var(--z));
}
.disc-lines-list dt { color: var(--muted); }
.disc-lines-list dd { margin: 0; overflow-wrap: anywhere; }
.disc-edit { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 10px; }
.disc-schedules h2 { margin: 0; }
.disc-schedules select { width: auto; }
.disc-schedule-list .row { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
@media (max-width: 1100px) {
  .disc-scan-form { grid-template-columns: 1fr 1fr; }
  .disc-main { grid-template-columns: 1fr; }
  .disc-details { position: static; }
}
@media (max-width: 720px) {
  .disc-scan-form { grid-template-columns: 1fr; }
  .disc-table .col-mac, .disc-table .col-vendor, .disc-table .col-first_seen,
  .disc-table .col-last_seen { display: none; }
}

/* The Discovery tab's Map: the switches the server polls, and the drawing
   (SVG, in the skin's colours). */
.disc-head { display: flex; align-items: flex-end; gap: 12px; }
.disc-head .grow { flex: 1; }
.disc-views .field { margin: 0; }
.disc-switches { display: flex; flex-direction: column; gap: 10px; }
.disc-card-head { display: flex; align-items: center; gap: 8px; }
.disc-card-head h2 { margin: 0; }
.disc-card-head .grow { flex: 1; }
.disc-switch-list { margin: 0; padding: 0; list-style: none; }
.disc-switch {
  display: flex; align-items: center; gap: 8px; padding: 8px 0;
  border-top: 1px solid var(--border);
}
.disc-switch:first-child { border-top: 0; }
.disc-switch .grow { flex: 1; min-width: 0; }
.disc-switch .switch-poll.err { color: var(--err); }
.disc-map-card { padding: 0; overflow: hidden; }
.disc-map-card:empty { display: none; }
.disc-map-scroll { overflow: auto; max-height: 72vh; }
.topology-map { display: block; font-family: var(--ui); }
.topology-map .map-wire { stroke: var(--border); stroke-width: 1.5; }
.topology-map .map-link path { fill: none; stroke: var(--accent); stroke-width: 2.5; }
.topology-map .map-link-label { fill: var(--accent); font-size: 11px; font-weight: 600; }
.topology-map .map-box rect { fill: var(--card); stroke: var(--border); stroke-width: 1; }
.topology-map .map-title { fill: var(--text); font-size: 12.5px; font-weight: 600; }
.topology-map .map-sub { fill: var(--muted); font-size: 11px; }
.topology-map .map-switch rect { fill: var(--selected); stroke: var(--accent); stroke-width: 1.5; }
.topology-map .map-switch .map-title { font-size: 14px; }
.topology-map .map-switch.map-error rect { stroke: var(--err); stroke-dasharray: 5 3; }
.topology-map .map-port rect { fill: var(--hover); }
.topology-map .map-port .map-title { fill: var(--muted); font-family: var(--mono); font-size: 11.5px; font-weight: 500; }
.topology-map .map-neighbour rect { stroke: var(--accent); stroke-dasharray: 4 2; }
.topology-map .map-device { cursor: pointer; }
.topology-map .map-device:hover rect { fill: var(--hover); }
.topology-map .map-more rect { fill: none; stroke-dasharray: 2 3; }
.topology-map .map-more .map-title { fill: var(--muted); font-weight: 400; font-size: 11.5px; }
@media (max-width: 720px) {
  .disc-head { flex-direction: column; align-items: stretch; }
  .disc-switch { flex-wrap: wrap; }
}
