/* Theme tokens. --accent is set from Settings at runtime. */
:root {
  --accent: #3b82f6;
  --accent-strong: color-mix(in srgb, var(--accent) 82%, black);
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 45%, transparent);
  --on-accent: #fff;
  --ok: #3fb950;
  --warn: #d29922;
  --danger: #f85149;
  --radius: 8px;
  --mono: "JetBrains Mono", "Fira Code", "Cascadia Code", Menlo, Consolas, monospace;
}
:root, :root[data-theme="dark"] {
  --bg: #0b0f14;
  --bg-2: #11161d;
  --bg-3: #161c25;
  --bg-4: #1d2530;
  --hover: #253040;
  --line: #242d39;
  --line-2: #2f3a48;
  --text: #d6dde6;
  --muted: #8592a3;
  --shadow: 0 12px 40px rgba(0, 0, 0, .5);
  --overlay: rgba(1, 4, 9, .65);
  --row-line: #151b23;
  --danger-bg: #8e1f1a;
}
:root[data-theme="light"] {
  --bg: #f6f7f9;
  --bg-2: #ffffff;
  --bg-3: #ffffff;
  --bg-4: #eef1f5;
  --hover: #e3e8ef;
  --line: #e1e5eb;
  --line-2: #cfd6df;
  --text: #1c2430;
  --muted: #667085;
  --shadow: 0 12px 40px rgba(15, 23, 42, .16);
  --overlay: rgba(15, 23, 42, .35);
  --row-line: #eef0f3;
  --danger-bg: #d92d20;
  --ok: #1a7f37;
  --warn: #9a6700;
  --danger: #cf222e;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.break { word-break: break-all; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.danger-text { color: var(--danger); }
.icon { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h4 { margin: 14px 0 8px; font-size: 13px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

#app { display: flex; flex-direction: column; height: 100vh; }

/* ---------- tabs ---------- */
#tabbar {
  display: flex; gap: 2px; padding: 6px 8px 0; background: var(--bg-2);
  border-bottom: 1px solid var(--line); overflow-x: auto; flex: none;
}
.tab {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px 7px 12px; min-width: 0; max-width: 240px;
  border-radius: 8px 8px 0 0; color: var(--muted); cursor: pointer; user-select: none; white-space: nowrap;
  border: 1px solid transparent; border-bottom: none;
}
.tab:hover { background: var(--bg-4); color: var(--text); }
.tab.active { background: var(--bg); color: var(--text); border-color: var(--line); margin-bottom: -1px; box-shadow: inset 0 2px 0 var(--accent); }
.tab.fixed { font-weight: 600; }
.tab-title { overflow: hidden; text-overflow: ellipsis; }
.tab-close { background: none; border: 0; padding: 2px; border-radius: 4px; display: flex; color: var(--muted); cursor: pointer; opacity: .6; }
.tab-close:hover { background: var(--hover); opacity: 1; color: var(--text); }
#views { flex: 1; min-height: 0; position: relative; }
#views > * { position: absolute; inset: 0; }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); flex: none; }
.dot.connected { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot.connecting { background: var(--warn); animation: pulse 1s infinite; }
.dot.closed { background: var(--danger); }
@keyframes pulse { 50% { opacity: .3; } }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 7px;
  background: var(--bg-4); border: 1px solid var(--line-2); cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--hover); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }
.btn.danger { background: var(--danger-bg); border-color: var(--danger-bg); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--bg-4); color: var(--text); }
.btn.ghost.danger:hover { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.btn.icon-only { padding: 6px; }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.toggle.active { background: color-mix(in srgb, var(--danger) 15%, transparent); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.btn.active:not(.toggle) { color: var(--accent); background: var(--accent-soft); }
.sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 6px; }

input, select, textarea {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 7px; padding: 7px 10px; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--accent); margin: 0; }
input[type=range] { padding: 0; accent-color: var(--accent); border: 0; box-shadow: none; background: none; }
textarea { resize: vertical; }
.search { max-width: 280px; }

.segmented { display: inline-flex; background: var(--bg-4); border: 1px solid var(--line-2); border-radius: 8px; padding: 3px; gap: 2px; }
.segmented button { border: 0; background: none; padding: 5px 14px; border-radius: 6px; cursor: pointer; color: var(--muted); display: flex; gap: 6px; align-items: center; }
.segmented button.active { background: var(--bg-2); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, .2); }

/* ---------- vault layout ---------- */
.vault { display: flex; }
.nav { width: 220px; flex: none; background: var(--bg-2); border-right: 1px solid var(--line); padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; padding: 4px 8px 18px; }
.logo { background: var(--accent); color: var(--on-accent); border-radius: 7px; font-family: var(--mono); font-size: 12px; padding: 3px 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; border: 0; background: none; color: var(--muted); cursor: pointer; text-align: left; }
.nav-item:hover { background: var(--bg-4); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item span:nth-child(2) { flex: 1; }
.count { font-size: 11px; background: var(--bg-4); color: var(--muted); padding: 1px 7px; border-radius: 10px; }
.nav-foot { margin-top: auto; padding: 8px; line-height: 1.7; }
.vault-content { flex: 1; min-width: 0; overflow: auto; }
.page { padding: 22px 28px 60px; }
.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h2 { margin: 0 12px 0 0; font-size: 20px; }

.selbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
  background: color-mix(in srgb, var(--accent) 12%, var(--bg-2)); border: 1px solid var(--accent-line); border-radius: var(--radius); padding: 6px 10px; margin-bottom: 14px;
}
.selbar b { margin-right: 10px; }

.group { margin-bottom: 18px; border-radius: var(--radius); }
.group.drop { outline: 2px dashed var(--accent); outline-offset: 4px; }
.group-head { display: flex; align-items: center; gap: 8px; padding: 4px 0 8px; }
.group-head h3 { margin: 0; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); cursor: pointer; }
.group-dot { width: 10px; height: 10px; border-radius: 3px; }
.chevron { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0 2px; transition: transform .15s; }
.chevron.closed { transform: rotate(-90deg); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.check.small { font-size: 12px; color: var(--muted); margin-right: 4px; }

.host-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(290px, 100%), 1fr)); gap: 10px; }
.host-card {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--radius);
  background: var(--bg-3); border: 1px solid var(--line); cursor: default; transition: border-color .12s, background .12s;
}
.host-card:hover { border-color: var(--line-2); background: var(--bg-4); }
.host-card.selected { border-color: var(--accent); background: var(--accent-soft); }
.host-check { position: absolute; top: 8px; left: 8px; opacity: 0; transition: opacity .1s; }
.host-card:hover .host-check, .host-card.selected .host-check, .selbar:not([hidden]) ~ .groups .host-check { opacity: 1; }
.host-icon, .key-icon { width: 40px; height: 40px; border-radius: 9px; display: grid; place-items: center; flex: none;
  background: color-mix(in srgb, var(--accent) 20%, var(--bg-3)); color: var(--accent); }
.host-icon.rdp { background: color-mix(in srgb, #a371f7 22%, var(--bg-3)); color: #a371f7; }
.key-icon { background: color-mix(in srgb, #e3b341 20%, var(--bg-3)); color: #c69026; }
.host-info, .key-info { flex: 1; min-width: 0; }
.host-label { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.host-sub { color: var(--muted); font-size: 12px; font-family: var(--mono); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badges { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; padding: 1px 7px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line-2); color: var(--muted); }
.badge.key { color: #c69026; border-color: color-mix(in srgb, #c69026 40%, transparent); }
.badge.rdp { color: #a371f7; border-color: color-mix(in srgb, #a371f7 40%, transparent); font-weight: 600; }
.badge.warn { color: var(--warn); }
.host-actions { display: flex; opacity: .6; transition: opacity .12s; }
.host-card:hover .host-actions { opacity: 1; }

.key-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(560px, 100%), 1fr)); gap: 10px; }
.key-info { overflow-wrap: anywhere; } /* long fingerprints wrap */
.key-card { display: flex; align-items: center; gap: 14px; padding: 12px 14px; background: var(--bg-3); border: 1px solid var(--line); border-radius: var(--radius); }
.key-actions { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }

.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr)); gap: 10px; }
.folder-tile { display: flex; align-items: center; gap: 12px; padding: 12px 10px 12px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-3); cursor: pointer; outline: none; min-width: 0; }
.folder-tile:hover, .folder-tile:focus-visible { border-color: var(--line-2); background: var(--bg-4); }
.folder-tile.drop { outline: 2px dashed var(--accent); outline-offset: 2px; }
.folder-tile.shared { border-style: dashed; }
.folder-grid.shared-groups { margin-bottom: 18px; }
.folder-icon { flex: none; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; }
.folder-info { flex: 1; min-width: 0; }
.folder-name { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-tile > .btn { opacity: .6; }
.folder-tile:hover > .btn { opacity: 1; }
.group-head.inside { padding-bottom: 12px; }
.group-head.inside h3 { font-size: 16px; text-transform: none; letter-spacing: 0; color: var(--text); cursor: default; }
.group-head .back { padding-left: 4px; }
.empty.small { padding: 30px 20px; }
.empty { text-align: center; padding: 70px 20px; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.empty h3 { color: var(--text); margin: 10px 0 0; }
.empty .row { margin-top: 14px; justify-content: center; }

table.data, table.results { width: 100%; border-collapse: collapse; }
table.data th { text-align: left; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.data td, table.results td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.results td:last-child { width: 45%; }
table.results input { margin-top: 4px; }
table.kv td { padding: 4px 12px 4px 0; vertical-align: top; }
table.kv td:first-child { white-space: nowrap; width: 90px; }
.perm-grid { border-collapse: collapse; }
.perm-grid th { font-weight: 500; font-size: 12px; color: var(--muted); padding: 2px 12px; }
.perm-grid td { padding: 4px 12px; text-align: center; }
.perm-grid td:first-child { text-align: left; padding-left: 0; }
.status { font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--bg-4); }
.status.added { color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, transparent); }
.status.duplicate { color: var(--muted); }
.status.needs_passphrase { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent); }
.status.error { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); }

/* ---------- settings ---------- */
.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.card h3 { margin: 0 0 6px; font-size: 15px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.card-head h3 { margin: 0; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.setting-row:first-of-type { border-top: 0; }
.scheme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(170px, 100%), 1fr)); gap: 12px; margin-top: 10px; }
.scheme { border: 2px solid var(--line); border-radius: 10px; padding: 0; background: var(--bg-3); cursor: pointer; overflow: hidden; text-align: left; transition: border-color .12s, transform .12s; }
.scheme:hover { border-color: var(--line-2); transform: translateY(-1px); }
.scheme.active { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.scheme-screen { padding: 8px 10px; font: 11px/1.5 var(--mono); white-space: nowrap; overflow: hidden; }
.swatch-row { display: flex; gap: 3px; margin-top: 6px; }
.swatch-row i { flex: 1; height: 6px; border-radius: 2px; }
.scheme-name { padding: 6px 10px; font-size: 12px; font-weight: 500; }
.color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin: 8px 0; }
.color-field { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 13px; text-transform: capitalize; }
.color-field.changed { border-color: var(--accent-line); }
.color-field input { width: 30px; height: 24px; padding: 0; border: 0; border-radius: 5px; background: none; cursor: pointer; box-shadow: none; }
details summary { cursor: pointer; color: var(--muted); padding: 6px 0; }
.term-preview { border-radius: 8px; padding: 10px; overflow: hidden; border: 1px solid var(--line); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 26px; height: 26px; border-radius: 7px; border: 2px solid transparent; cursor: pointer; padding: 0; }
.swatch.active { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg-2) inset; }
.swatch.custom { position: relative; display: grid; place-items: center; background: conic-gradient(red, yellow, lime, cyan, blue, magenta, red); color: #fff; overflow: hidden; }
.swatch.custom input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }

/* ---------- modals ---------- */
.overlay { position: fixed; inset: 0; background: var(--overlay); display: grid; place-items: center; z-index: 100; padding: 16px; animation: fade .12s; }
.overlay.top { z-index: 350; } /* above .auth-screen: dialogs that are part of signing in */
@keyframes fade { from { opacity: 0; } }
.modal { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 12px; width: min(500px, 100%); max-height: calc(100vh - 32px); display: flex; flex-direction: column; box-shadow: var(--shadow); }
.modal.wide { width: min(860px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 6px 20px; }
.modal-head h3 { margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 8px 20px 4px; overflow: auto; }
.modal-body p { margin: 0 0 8px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; }
.modal-body .modal-actions { padding: 14px 0 14px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.span2 { grid-column: span 2; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field-label { font-size: 12px; color: var(--muted); font-weight: 500; }
.hint { color: var(--muted); font-size: 11.5px; }
.fingerprint, .pubkey { background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 10px; font-family: var(--mono); font-size: 12px; white-space: pre-wrap; word-break: break-all; margin: 0 0 10px; }
.editor { width: 100%; height: 60vh; font-family: var(--mono); font-size: 13px; tab-size: 4; white-space: pre; }
.checklist { max-height: 42vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; background: var(--bg); }
.check-group { padding: 4px 0 8px; }
.check-group > .check:not(.group-name) { padding: 3px 0 3px 22px; }
.check-group .group-name { padding: 3px 0; }
.pick-list { max-height: 50vh; overflow: auto; display: flex; flex-direction: column; gap: 2px; }
.pick-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 7px; border: 0; background: none; text-align: left; cursor: pointer; }
.pick-item:hover { background: var(--bg-4); }
.find-results .pick-item { padding: 5px 10px; word-break: break-all; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 20px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- toasts & context menu ---------- */
#toasts { position: fixed; bottom: 18px; right: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 200; max-width: 420px; }
.toast { background: var(--bg-3); border: 1px solid var(--line-2); border-left: 3px solid var(--accent); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); transition: opacity .3s, transform .3s; animation: fade .15s; word-break: break-word; }
.toast.ok { border-left-color: var(--ok); }
.toast.warn { border-left-color: var(--warn); }
.toast.error { border-left-color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(8px); }
.ctx-menu { position: fixed; z-index: 150; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 9px; padding: 4px; min-width: 200px; max-height: 70vh; overflow: auto; box-shadow: var(--shadow); }
.ctx-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; text-align: left; white-space: nowrap; }
.ctx-item:hover { background: var(--bg-4); }
.ctx-item.danger { color: var(--danger); }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 6px; }
.ctx-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; border: 1px solid var(--line-2); flex: none; }

/* ---------- terminal tabs ---------- */
.term-tab, .sftp-tab, .rdp-tab { display: flex; flex-direction: column; background: var(--bg); outline: none; }
.toolbar { display: flex; align-items: center; gap: 2px; padding: 5px 8px; border-bottom: 1px solid var(--line); background: var(--bg-2); flex: none; flex-wrap: wrap; }
.toolbar-title { display: flex; align-items: center; gap: 6px; padding: 0 8px; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.layout { flex: 1; min-height: 0; display: flex; padding: 4px; }
.layout > * { flex: 1; min-width: 0; min-height: 0; }
.split { display: flex; min-width: 0; min-height: 0; }
.split.h { flex-direction: row; }
.split.v { flex-direction: column; }
.split-child { display: flex; min-width: 0; min-height: 0; }
.split-child > * { flex: 1; min-width: 0; min-height: 0; }
.divider { flex: none; background: transparent; position: relative; z-index: 2; }
.split.h > .divider { width: 6px; cursor: col-resize; }
.split.v > .divider { height: 6px; cursor: row-resize; }
.divider:hover, body.resizing-h .divider, body.resizing-v .divider { background: var(--accent-line); }
body.resizing-h { cursor: col-resize; user-select: none; }
body.resizing-v { cursor: row-resize; user-select: none; }
body.resizing-h .pane-body, body.resizing-v .pane-body { pointer-events: none; }

.pane { display: flex; flex-direction: column; position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.pane.focused { border-color: var(--accent-line); }
.pane.broadcast { border-color: color-mix(in srgb, var(--danger) 55%, transparent); }
.pane-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 2px 10px; font-size: 12px; color: var(--muted); background: var(--bg-2); border-bottom: 1px solid var(--line); flex: none; }
.pane.focused .pane-head { color: var(--text); }
.pane-head .btn { padding: 3px; }
.pane-body { flex: 1; min-height: 0; padding: 4px 0 0 6px; }
.pane-body .xterm { height: 100%; }
.pane-overlay { position: absolute; inset: 26px 0 0; display: grid; place-items: center; background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(1px); }
.pane-overlay-box { display: flex; flex-direction: column; gap: 10px; align-items: center; text-align: center; padding: 18px 22px; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 10px; max-width: 80%; }
.pane-overlay-box .spinner { margin: 4px auto; }

/* ---------- rdp ---------- */
.rdp-stage { flex: 1; min-height: 0; position: relative; background: #000; overflow: hidden; }
.rdp-screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; outline: none; }
.rdp-screen > div { cursor: default; }
.rdp-overlay { inset: 0; }

/* ---------- sftp ---------- */
.file-panes { flex: 1; min-height: 0; display: flex; gap: 6px; padding: 6px; }
.file-pane { flex: 1; min-width: 0; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--bg); }
.file-panes.dual .file-pane.active { border-color: var(--accent-line); box-shadow: 0 0 0 1px var(--accent-line); }
.pane-bar { display: flex; align-items: center; gap: 2px; padding: 4px 6px; background: var(--bg-2); border-bottom: 1px solid var(--line); }
.pane-host { max-width: 180px; font-weight: 600; color: var(--text); }
.pane-host span { overflow: hidden; text-overflow: ellipsis; }
.path-input { flex: 1; min-width: 120px; font-family: var(--mono); font-size: 13px; padding: 5px 10px; margin: 0 4px; }
.filter { width: 130px; padding: 5px 10px; margin-left: 4px; }
.file-list { flex: 1; min-height: 0; overflow: auto; outline: none; }
.file-list.drop { outline: 2px dashed var(--accent); outline-offset: -6px; background: var(--accent-soft); }
.file-list table { width: 100%; border-collapse: collapse; }
.file-list th { position: sticky; top: 0; z-index: 1; background: var(--bg-2); text-align: left; font-weight: 500; font-size: 12px; color: var(--muted); padding: 7px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.file-list th.sortable { cursor: pointer; user-select: none; }
.file-list th.sortable:hover, .file-list th.sorted { color: var(--text); }
.file-list td { padding: 5px 12px; border-bottom: 1px solid var(--row-line); white-space: nowrap; user-select: none; }
.file-list tr:hover td { background: var(--bg-3); }
.file-list tr.selected td { background: var(--accent-soft); }
.file-list tr.drop-target td { background: color-mix(in srgb, var(--accent) 28%, transparent); }
.file-list .name { display: flex; align-items: center; gap: 8px; }
.file-list .name .icon { color: var(--muted); }
.file-list .name span:first-of-type { overflow: hidden; text-overflow: ellipsis; }
.file-list .num { text-align: right; width: 100px; }
.transfers { flex: none; display: flex; flex-direction: column; max-height: 30vh; overflow: auto; }
.transfer { display: grid; grid-template-columns: auto 1fr auto; gap: 4px 10px; align-items: center; padding: 6px 12px; border-top: 1px solid var(--line); background: var(--bg-2); font-size: 12px; }
.transfer .btn { padding: 2px; }
.transfer-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress { grid-column: 1 / -1; height: 4px; background: var(--bg-4); border-radius: 2px; overflow: hidden; }
.progress-fill { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.transfer.done .progress-fill { background: var(--ok); }
.transfer.failed .progress-fill { background: var(--danger); width: 100% !important; }
.statusbar { flex: none; padding: 4px 12px; font-size: 12px; color: var(--muted); border-top: 1px solid var(--line); background: var(--bg-2); font-family: var(--mono); }

/* ---------- auth ---------- */
.auth-screen { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; padding: 16px; overflow: auto;
  background: radial-gradient(1200px 600px at 10% -10%, var(--accent-soft), transparent), var(--bg); }
.auth-tabs { display: flex; margin: 4px 0 18px; }
.account-kind { display: flex; }
.account-kind button { flex: 1; justify-content: center; }
.auth-tabs button { flex: 1; justify-content: center; padding: 7px 10px; }
.auth-card { width: min(400px, 100%); background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.auth-card h2 { font-size: 18px; margin: 18px 0 6px; }
.auth-card .form { margin-top: 16px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; }
.auth-error { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, transparent); border-radius: 7px; padding: 8px 10px; font-size: 13px; }
.btn.wide { width: 100%; justify-content: center; padding: 9px; }
.center { text-align: center; }
.pad { padding: 8px 10px; }
a { color: var(--accent); }

/* ---------- account / avatars ---------- */
.nav-foot { display: flex; flex-direction: column; gap: 10px; }
.account-chip { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--bg-3); cursor: pointer; text-align: left; }
.account-chip:hover { background: var(--bg-4); }
.account-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.account-name b, .account-name small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 28px; height: 28px; border-radius: 50%; flex: none; display: inline-grid; place-items: center; font-size: 12px; font-weight: 700;
  background: color-mix(in srgb, var(--accent) 22%, var(--bg-3)); color: var(--accent); }
.avatar.small { width: 20px; height: 20px; font-size: 10px; }
.avatar.big { width: 40px; height: 40px; }
.avatar.team { border-radius: 8px; background: color-mix(in srgb, #14b8a6 22%, var(--bg-3)); color: #14b8a6; }
.avatars { display: flex; }
.avatars .avatar { margin-left: -6px; border: 2px solid var(--bg-2); }

/* ---------- sharing ---------- */
.shared-divider { display: flex; align-items: center; gap: 8px; margin: 26px 0 12px; color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.shared-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.group.shared .group-head h3 { text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--text); }
.host-card.is-shared, .key-card.is-shared { border-style: dashed; }
.badge.shared { color: var(--accent); border-color: var(--accent-line); }
.badge.access-connect { color: #d29922; border-color: color-mix(in srgb, #d29922 45%, transparent); }
.badge.access-files { color: #14b8a6; border-color: color-mix(in srgb, #14b8a6 45%, transparent); }
.badge.access-edit, .badge.access-use { color: #a371f7; border-color: color-mix(in srgb, #a371f7 45%, transparent); }
.badge.ok { color: var(--ok); }
.key-info .host-label { display: flex; align-items: center; gap: 8px; }
.share-btn { position: relative; }
.badge.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, transparent); }
.share-who { display: flex; flex-direction: column; gap: 8px; }
.share-who p { margin: 0; }
.share-count { position: absolute; top: -2px; right: -4px; font-size: 10px; background: var(--accent); color: var(--on-accent); border-radius: 8px; padding: 0 4px; line-height: 14px; }
.picker { position: relative; border: 1px solid var(--line-2); border-radius: 8px; padding: 4px; display: flex; flex-wrap: wrap; gap: 4px; background: var(--bg); }
.picker:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.picker > input { flex: 1; min-width: 160px; border: 0; box-shadow: none !important; padding: 5px 6px; background: transparent; }
.chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 4px 3px 8px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); font-size: 13px; }
.chip button { border: 0; background: none; color: inherit; cursor: pointer; display: flex; padding: 2px; border-radius: 50%; }
.chip button:hover { background: var(--accent-soft); }
.picker-list { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 10; background: var(--bg-3); border: 1px solid var(--line-2); border-radius: 9px; box-shadow: var(--shadow); max-height: 260px; overflow: auto; padding: 4px; }
.perm-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; }
.perm-card { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 9px; cursor: pointer; }
.perm-card.active { border-color: var(--accent); background: var(--accent-soft); }
.perm-card input { margin-top: 3px; }
table.data.compact td { padding: 6px 8px; }
table.data select { width: auto; padding: 4px 8px; }
.team-card .card-head { cursor: pointer; margin: 0; }
.team-card table { margin-top: 12px; }
.disabled-row { opacity: .55; }

.warn-text { color: var(--warn); }

.auth-links { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 14px; font-size: 13px; flex-wrap: wrap; }
.auth-info { color: var(--ok); background: color-mix(in srgb, var(--ok) 10%, transparent); border-radius: 7px; padding: 8px 10px; font-size: 13px; }
.code-input { font-family: var(--mono); font-size: 26px; letter-spacing: 10px; text-align: center; padding: 10px; }
.invite-preview { border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.invite-preview.ok { background: color-mix(in srgb, var(--ok) 10%, transparent); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.invite-preview.bad { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); }
.invite-preview ul { margin: 6px 0 0; padding-left: 18px; }
.chip.invite { background: color-mix(in srgb, var(--warn) 16%, transparent); color: var(--warn); border: 1px dashed color-mix(in srgb, var(--warn) 50%, transparent); }
.invite-result { border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: 9px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.invite-row { display: flex; align-items: center; gap: 8px; }
.invite-row code { font-size: 15px; font-weight: 600; letter-spacing: 1px; }
.invite-code-box { border: 1px solid var(--line); border-radius: 9px; padding: 6px 12px; }
.invite-code-box .row { align-items: flex-end; }
.invite-code-box select { width: auto; }

/* ---------- vault: recovery phrase, lock ---------- */
.phrase-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; padding: 12px 12px 12px 34px; margin: 6px 0 12px;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; font-family: var(--mono); font-size: 13px; user-select: all; }
.phrase-grid li::marker { color: var(--muted); font-size: 11px; }
.phrase-grid li span { font-weight: 600; }
.phrase-actions { margin-bottom: 10px; }
.phrase-print { display: none; }
@media print {
  body.printing-phrase > *:not(.phrase-print) { display: none !important; }
  body.printing-phrase .phrase-print { display: block; color: #000; background: #fff; font: 14px/1.6 monospace; }
}
/* Locked: hide the app (terminal/RDP output included) behind the unlock screen. */
body.locked #app { visibility: hidden; }
body.locked .auth-screen { background: var(--bg); }
.integrity-banner { flex: none; padding: 10px 16px; background: color-mix(in srgb, var(--danger) 18%, var(--bg-2)); border-bottom: 1px solid var(--danger); color: var(--text); font-size: 13px; }

.choice-list { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 4px; }
.choice { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 12px 14px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg-3); cursor: pointer; }
.choice:hover { border-color: var(--accent); background: var(--accent-soft); }
.warn-box { background: color-mix(in srgb, var(--warn) 12%, transparent); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.reset-banner { display: flex; gap: 12px; align-items: center; background: color-mix(in srgb, var(--warn) 16%, var(--bg-2)); border-bottom-color: var(--warn); }
.reset-banner > div { flex: 1; }

/* ---------- responsive ---------- */
/* Pages use the full width. Settings flows into two columns where there is
   room; tables scroll inside their card instead of widening the page. */
.page.settings { columns: 2 560px; column-gap: 16px; }
.page.settings > .page-head { column-span: all; }
.page.settings > .card { break-inside: avoid; display: inline-block; width: 100%; box-sizing: border-box; }
.card:has(> table.data) { overflow-x: auto; }
@media (min-width: 1900px) {
  body { font-size: 15px; }
}
@media (max-width: 1100px) {
  .page { padding: 18px 20px 48px; }
  .nav { width: 196px; }
}
/* Tablets and phones: the nav becomes an icon rail (labels as tooltips);
   the account button stays, as an avatar. This block stays at the end of
   the file so it overrides the base rules above. */
@media (max-width: 900px) {
  .nav { width: 60px; padding: 10px 6px; align-items: center; }
  .nav-item { justify-content: center; position: relative; padding: 10px; }
  .nav-item span, .brand, .shortcuts, .account-name { display: none; }
  .nav-item .count { display: none; }
  .nav-foot { padding: 4px 0; }
  .account-chip { padding: 6px; justify-content: center; }
  .page { padding: 14px 14px 40px; }
  .page-head { gap: 8px; }
  .page-head h2 { font-size: 18px; margin-right: 4px; }
  .page-head .search { order: 10; flex: 1 1 100%; max-width: none; }
  .card { padding: 14px; }
  .setting-row { gap: 10px; }
  .setting-row > :last-child { max-width: 100%; }
  .form.grid2 { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .toolbar .btn span { display: none; }
  .file-panes.dual { flex-direction: column; }
  .file-list .num, .file-list th.num { display: none; }
  .modal-body { padding: 8px 14px 4px; }
  .modal-actions { padding: 12px 14px 14px; flex-wrap: wrap; }
  #toasts { left: 12px; right: 12px; bottom: 12px; max-width: none; }
  .key-card { flex-wrap: wrap; }
  .group-head { flex-wrap: wrap; row-gap: 4px; }
}
/* ---------- two-factor ---------- */
.mfa-step-icon { display: grid; place-items: center; width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 6px; color: var(--accent); background: var(--accent-soft); }
.auth-card .mfa-code { font-size: 24px; }
.mfa-code { font-family: var(--mono); font-size: 20px; letter-spacing: .2em; text-align: center; }
.mfa-steps { margin: 0; padding-left: 20px; line-height: 1.6; }
.mfa-qr-wrap { display: flex; justify-content: center; }
.mfa-qr { background: #fff; border-radius: 8px; image-rendering: pixelated; }
.mfa-key { font-family: var(--mono); font-size: 13px; padding: 4px 8px; background: var(--bg-4); border-radius: 6px; user-select: all; word-break: break-all; }
.backup-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; padding: 12px 16px; background: var(--bg-4); border-radius: 8px; font-size: 15px; letter-spacing: .04em; user-select: all; }

/* ---------- terminal font dropdown ---------- */
.font-dd { position: relative; margin-bottom: 6px; }
.font-dd-button { display: flex; align-items: center; gap: 12px; width: 100%; padding: 8px 12px; border: 1px solid var(--line-2); border-radius: 8px; background: var(--bg); color: var(--text); cursor: pointer; text-align: left; }
.font-dd-button:hover, .font-dd-button[aria-expanded="true"] { border-color: var(--accent-line); }
.font-dd-name { font-size: 15px; }
.font-dd-sample { color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; }
.font-dd-panel { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow); padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.font-dd-search { width: 100%; }
.font-dd-list { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; }
.font-dd-group { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 10px 4px; }
.font-dd-item { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 7px 10px; border: 0; border-radius: 6px; background: none; color: var(--text); cursor: pointer; text-align: left; }
.font-dd-item:hover, .font-dd-item.kbd { background: var(--hover); }
.font-dd-item.selected { color: var(--accent); }
.font-dd-item.selected .font-dd-item-name::after { content: "  ✓"; }
.font-dd-item-name { font-size: 15px; white-space: nowrap; }
.font-dd-item-sample { font-size: 13px; color: var(--muted); white-space: nowrap; }
.font-dd-empty { padding: 10px; }
@media (max-width: 600px) {
  .font-dd-sample, .font-dd-item-sample { display: none; }
}

/* ---------- app theme picker ---------- */
.ui-theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(150px, 100%), 1fr)); gap: 10px; margin: 10px 0 14px; }
.ui-theme { all: unset; box-sizing: border-box; cursor: pointer; border: 2px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg-3); display: flex; flex-direction: column; }
.ui-theme:hover { border-color: var(--line-2); }
.ui-theme:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ui-theme.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.ui-theme-split { display: flex; }
.ui-theme-split > * { flex: 1; min-width: 0; }
.ui-theme-mini { height: 64px; display: flex; gap: 5px; padding: 6px; }
.ui-theme-side { width: 24%; border-right: 1px solid; border-radius: 4px; display: flex; flex-direction: column; gap: 4px; padding: 4px; }
.ui-theme-side i { display: block; height: 4px; border-radius: 2px; }
.ui-theme-main { flex: 1; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ui-theme-card { flex: 1; border: 1px solid; border-radius: 4px; padding: 4px; display: flex; flex-direction: column; gap: 4px; }
.ui-theme-card b { display: block; height: 4px; width: 60%; border-radius: 2px; opacity: .85; }
.ui-theme-card span { display: block; height: 4px; width: 35%; border-radius: 2px; }
.ui-theme-name { padding: 6px 9px 7px; font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- session logs ---------- */
.logs-note { display: flex; align-items: center; gap: 4px; margin: -4px 0 14px; }
.logs-owner { width: auto; }
.logs-table td { vertical-align: middle; }
.log-actions { gap: 2px; justify-content: flex-end; }
.log-row { cursor: default; }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--ok); margin-right: 5px; animation: pulse 1.2s infinite; }
.log-viewer { display: flex; flex-direction: column; gap: 10px; }
.log-viewer-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; }
.log-screen { height: min(60vh, 560px); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; padding: 6px; background: #000; }
.log-viewer-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
@media (max-width: 600px) {
  .logs-table th:nth-child(4), .logs-table td:nth-child(4) { display: none; }
  .log-screen { height: 55vh; }
}

/* ---------- theme picker ---------- */
.scheme-picker { display: flex; flex-direction: column; gap: 12px; }
.scheme-picker-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; position: sticky; top: -8px; z-index: 2; background: var(--bg-2); padding: 4px 0; }
.scheme-picker-bar .search { flex: 1 1 220px; max-width: none; }
.picker-default { align-self: flex-start; }
.picker-grid { max-height: none; }
.picker-more { display: flex; justify-content: center; }
.picker-more .btn[hidden] { display: none; }

/* ---------- passwords ---------- */
.pw-checkup { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.pw-checkup[hidden] { display: none; }
.pw-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-3); color: var(--text); font: inherit; font-size: 13px; cursor: pointer; }
.pw-chip b { font-weight: 600; color: var(--muted); }
.pw-chip.warn b { color: var(--warn); }
.pw-chip.active { border-color: var(--accent); background: var(--accent-soft); }
.pw-hint { margin-left: auto; display: inline-flex; align-items: center; gap: 4px; }
.pw-list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg-2); overflow: hidden; }
.pw-list:has(> .empty), .pw-list:has(> .pw-none) { border: 0; background: none; }
.pw-row { display: grid; grid-template-columns: 36px minmax(140px, 1.3fr) minmax(120px, 1fr) minmax(150px, 1fr) 130px 64px; align-items: center; gap: 12px; padding: 9px 12px; border-bottom: 1px solid var(--row-line); outline: none; }
.pw-row:last-child { border-bottom: 0; }
.pw-row:hover, .pw-row:focus-visible { background: var(--bg-3); }
.pw-avatar { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; font-weight: 700; color: hsl(var(--hue) 70% 85%); background: hsl(var(--hue) 45% 30%); }
.pw-site, .pw-user, .pw-pass { min-width: 0; }
.pw-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw-site a, .pw-site span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pw-user, .pw-pass { display: flex; align-items: center; gap: 2px; }
.pw-username, .pw-secret { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 0 1 auto; margin-right: 2px; }
.pw-secret.masked { letter-spacing: .1em; color: var(--muted); }
.pw-user .btn, .pw-pass .btn, .pw-actions .btn { flex: none; }
.pw-row .pw-user .btn, .pw-row .pw-pass .btn { opacity: .55; }
.pw-row:hover .btn { opacity: 1; }
.pw-flags { display: flex; gap: 4px; }
.pw-actions { display: flex; }
.pw-input-row { display: flex; gap: 4px; align-items: center; }
.pw-input-row input { flex: 1; min-width: 0; }
.pw-strength { display: flex; align-items: center; gap: 8px; margin-top: 6px; min-height: 16px; }
.pw-strength-bar { flex: 0 0 120px; height: 5px; border-radius: 3px; background: var(--bg-4); overflow: hidden; }
.pw-strength-bar i { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s; }
.pw-strength[data-score="1"] .pw-strength-bar i { background: var(--warn); }
.pw-strength[data-score="2"] .pw-strength-bar i, .pw-strength[data-score="3"] .pw-strength-bar i { background: var(--ok); }
.pw-gen-inline { border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: var(--bg-3); }
.pw-gen-inline[hidden] { display: none; }
.pw-gen { display: flex; flex-direction: column; gap: 8px; }
.pw-gen-row { display: flex; gap: 4px; align-items: center; }
.pw-gen-out { flex: 1; min-width: 0; font-size: 15px; }
.pw-gen-opts { display: flex; flex-direction: column; gap: 10px; }
.pw-gen-len { display: flex; align-items: center; gap: 10px; }
.pw-gen-len input { flex: 1; }
.pw-gen-len b { min-width: 2ch; text-align: right; font-variant-numeric: tabular-nums; }
.pw-gen-exclude { display: flex; flex-direction: column; gap: 4px; }
.pw-exclude { flex: 1; min-width: 0; }
.pw-gen-exclude .btn.active { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }
.pw-symbols-note { overflow-wrap: anywhere; font-family: var(--mono); }
.pw-gen-checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; align-self: flex-start; }
.seg-btn { padding: 5px 14px; border: 0; background: none; color: var(--muted); font: inherit; cursor: pointer; }
.seg-btn.active { background: var(--accent-soft); color: var(--text); }
.pw-history summary { cursor: pointer; }
.pw-history-row { display: flex; align-items: center; gap: 10px; padding: 3px 0; }
.pw-history-row .mono { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pw-import-help { margin: 0; padding-left: 18px; }
@media (max-width: 1100px) {
  .pw-row { grid-template-columns: 36px minmax(0, 1fr) minmax(0, 1fr) auto; }
  .pw-pass { grid-column: 2 / 4; }
  .pw-flags { grid-column: 2 / 4; }
  .pw-flags:empty { display: none; }
  .pw-actions { grid-row: 1; grid-column: 4; }
}
@media (max-width: 600px) {
  .pw-row { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 4px 10px; }
  .pw-avatar { width: 28px; height: 28px; grid-row: span 2; }
  .pw-user, .pw-pass, .pw-flags { grid-column: 2 / 4; }
  .pw-actions { grid-row: 1; grid-column: 3; }
  .pw-row .btn { opacity: 1 !important; }
  .pw-hint { margin-left: 0; flex-basis: 100%; }
}

/* ---------- notes ---------- */
.notes-page { max-width: 1400px; }
.note-composer { max-width: 600px; margin: 4px auto 26px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-3); box-shadow: 0 1px 6px rgba(0,0,0,.18); display: flex; align-items: center; }
.note-composer[hidden] { display: none; }
.note-composer:not(.open) { padding: 2px 6px 2px 2px; }
.note-take { flex: 1; padding: 12px 14px; color: var(--muted); cursor: text; font-weight: 500; outline: none; }
.note-composer.open { display: block; }
.note-composer.tinted, .note-card.tinted, .note-modal.tinted { background: color-mix(in srgb, var(--note) 26%, var(--bg-3)); border-color: color-mix(in srgb, var(--note) 45%, var(--line)); }
.note-editor { display: flex; flex-direction: column; }
.note-editor-head { display: flex; align-items: center; padding: 6px 6px 0 2px; }
.note-title-input, .note-text-input, .note-item-text { background: transparent; border: 0; box-shadow: none; outline: none; color: var(--text); width: 100%; }
.note-title-input:focus, .note-text-input:focus, .note-item-text:focus { box-shadow: none; border: 0; }
.note-title-input { font-size: 16px; font-weight: 600; padding: 10px 14px 6px; }
.note-text-input { resize: none; min-height: 60px; padding: 6px 14px 10px; font: inherit; line-height: 1.5; }
.note-items { padding: 2px 6px 8px; }
.note-item { display: flex; align-items: center; gap: 6px; padding: 0 6px; }
.note-item .btn { opacity: 0; }
.note-item:hover .btn, .note-item:focus-within .btn { opacity: .7; }
.note-item.done .note-item-text { text-decoration: line-through; color: var(--muted); }
.note-item-text { padding: 5px 2px; }
.note-add-item { display: flex; align-items: center; gap: 6px; padding: 6px 12px; color: var(--muted); background: none; border: 0; cursor: pointer; font: inherit; }
.note-editor-foot { display: flex; align-items: center; gap: 2px; padding: 4px 8px 8px; }
.notes-label { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 8px 4px 8px; }
.notes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; align-items: start; margin-bottom: 18px; }
.note-card { position: relative; box-sizing: border-box; min-width: 0; padding: 12px 14px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-3); cursor: default; outline: none; transition: box-shadow .15s, border-color .15s; }
.note-card:hover, .note-card:focus-visible { box-shadow: 0 2px 10px rgba(0,0,0,.28); border-color: var(--line-2); }
.note-card > .btn:first-child { position: absolute; top: 4px; right: 4px; opacity: 0; }
.note-card:hover > .btn:first-child, .note-card > .btn.active:first-child { opacity: 1; }
.btn.active svg { color: var(--accent); }
.note-title { font-weight: 600; font-size: 15px; margin: 0 26px 6px 0; overflow-wrap: anywhere; }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; max-height: 22em; overflow: hidden; -webkit-mask-image: linear-gradient(#000 85%, transparent); mask-image: linear-gradient(#000 85%, transparent); }
.note-body:not(:has(+ *)) { mask-image: none; -webkit-mask-image: none; }
.note-checklist { display: flex; flex-direction: column; gap: 2px; }
.note-check { display: flex; align-items: flex-start; gap: 8px; padding: 2px 0; overflow-wrap: anywhere; }
.note-check input { margin-top: 3px; }
.note-done-count { margin-top: 4px; }
.note-actions { display: flex; gap: 0; margin: 6px -8px 0; opacity: 0; transition: opacity .15s; }
.note-card:hover .note-actions, .note-card:focus-within .note-actions { opacity: 1; }
.note-modal { width: min(640px, 100%); padding: 0; overflow: auto; }
.note-modal .note-text-input { min-height: 140px; }
@media (pointer: coarse), (max-width: 700px) {
  .note-actions, .note-card > .btn:first-child, .note-item .btn { opacity: 1; }
}
@media (max-width: 600px) {
  .notes-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; }
  .note-card { padding: 10px 10px 4px; }
  .note-actions { flex-wrap: wrap; }
  .note-composer { margin-bottom: 16px; }
}

/* Host usage meters in the terminal toolbar. */
.usage-meters { display: flex; align-items: center; gap: 14px; margin-right: 10px; font-size: 12px; color: var(--muted); }
.usage-meters[hidden] { display: none; }
.usage { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; cursor: default; }
.usage b { font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; min-width: 32px; text-align: right; }
.usage-bar { width: 48px; height: 6px; border-radius: 3px; background: var(--bg-4, var(--line)); overflow: hidden; }
.usage-fill { display: block; height: 100%; width: 0; background: var(--ok, #3fb950); transition: width .4s; }
.usage.warn .usage-fill { background: var(--warn, #d29922); }
.usage.crit .usage-fill { background: var(--danger, #f85149); }
.usage.crit b { color: var(--danger, #f85149); }
@media (max-width: 900px) {
  .usage-meters { gap: 8px; margin-right: 4px; }
  .usage-bar { width: 28px; }
}
@media (max-width: 600px) {
  .usage-meters { order: 10; flex: 1 1 100%; justify-content: space-between; padding: 2px 4px 0; margin: 0; }
  .usage-bar { flex: 1; width: auto; }
  .usage { flex: 1; }
}

/* Terminal key bar: Esc, Tab, Ctrl, arrows… for phones and tablets. */
.keybar { display: none; gap: 4px; padding: 5px 6px; background: var(--bg-2); border-top: 1px solid var(--line); overflow-x: auto; flex: none; scrollbar-width: none; touch-action: pan-x; }
.keybar .key { flex: none; min-width: 40px; height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg-3); color: var(--text); font-family: var(--mono); font-size: 13px; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
.keybar .key.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.rdp-type { display: none; }
@media (pointer: coarse), (max-width: 700px) {
  .keybar { display: flex; }
  .rdp-type { display: inline-flex; }
}
@media (max-width: 600px) {
  .file-list .col-time, .file-list .col-perm { display: none; }
  .file-list td, .file-list th { padding-left: 8px; padding-right: 8px; }
  .pane-bar { flex-wrap: wrap; row-gap: 4px; }
  .pane-host { max-width: 50%; }
  .path-input { order: 10; flex: 1 1 100%; margin: 0; min-width: 0; }
  .filter { flex: 1 1 80px; width: auto; min-width: 0; }
  .file-panes { padding: 4px; }
}
@media (max-width: 420px) {
  .page-head .btn { padding-left: 9px; padding-right: 9px; }
  .overlay { padding: 8px; }
}
