/* ShareDesk web viewer (connect.html). Same fonts and colour tokens as the website (site.css) and the account area,
   light and dark after the system setting. The remote screen itself stays on black in both. */
@font-face { font-family: "Bricolage Grotesque"; src: url(fonts/bricolage.woff2) format("woff2"); font-weight: 500 800; font-display: swap; }
@font-face { font-family: "Instrument Sans"; src: url(fonts/instrument-sans.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "JetBrains Mono"; src: url(fonts/jetbrains-mono.woff2) format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Instrument fallback"; src: local("Arial"), local("ArialMT"), local("Helvetica"); size-adjust: 103.2%; ascent-override: 94%; descent-override: 24.2%; line-gap-override: 0%; }
@font-face { font-family: "Bricolage fallback"; src: local("Arial"), local("ArialMT"), local("Helvetica"); size-adjust: 99.2%; ascent-override: 93.8%; descent-override: 27.2%; line-gap-override: 0%; }

:root {
  --red: #e5484d;
  --red-text: #b8353a;      /* small red text: ≥ 4.6:1 on paper and card */
  --red-btn: #d6353a;       /* white text on it: 4.7:1 */
  --red-btn-hover: #bb2f34;
  --ink: #121418;
  --paper: #f7f5f2;
  --paper-2: #efece7;
  --card: #ffffff;
  --muted: #5d6470;         /* 6.1:1 on card, 5.6:1 on paper */
  --line: #e2ded7;
  --field-line: #82888f;    /* field borders: 3:1 against card and paper (non-text contrast) */
  --ok: #1f9d55;
  --busy: #d98a00;
  --bar: rgba(255, 255, 255, 0.94);
  --tip-bg: #14171c;
  --tip-text: #f2f2f2;
  --warn-bg: rgba(255, 149, 0, 0.14);
  --focus: color-mix(in srgb, var(--ink) 14%, transparent);
  --shadow: 0 30px 60px -20px rgba(40, 20, 10, 0.25), 0 12px 24px -12px rgba(40, 20, 10, 0.18);
  --shadow-sm: 0 12px 28px -10px rgba(40, 20, 10, 0.28), 0 4px 10px -4px rgba(40, 20, 10, 0.14);
  --display: "Bricolage Grotesque", "Bricolage fallback", ui-sans-serif, sans-serif;
  --body: "Instrument Sans", "Instrument fallback", ui-sans-serif, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --radius: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --red-text: #ff8a8d;    /* 7:1 on card */
    --ink: #eef0f3;
    --paper: #0f1114;
    --paper-2: #23282f;
    --card: #1a1e24;
    --muted: #a3acb8;       /* 7:1 on card */
    --line: #2d333c;
    --field-line: #67707c;  /* 3:1 against card and paper */
    --ok: #3dd68c;
    --busy: #f0b429;
    --bar: rgba(26, 30, 36, 0.94);
    --tip-bg: #eef0f3;
    --tip-text: #121418;
    --warn-bg: rgba(255, 149, 0, 0.16);
    --shadow: 0 30px 60px -20px rgba(0, 0, 0, 0.7), 0 12px 24px -12px rgba(0, 0, 0, 0.5);
    --shadow-sm: 0 12px 28px -10px rgba(0, 0, 0, 0.7), 0 4px 10px -4px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.45 var(--body);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--red-text); text-underline-offset: 2px; }
a:focus-visible { outline: 2px solid var(--red-text); outline-offset: 2px; border-radius: 3px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.icon { width: 16px; height: 16px; flex: none; display: block; }

/* ---------- site header (connect view only; the session is full-screen) ---------- */

.site-nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--paper) 88%, transparent); border-bottom: 1px solid var(--line);
            backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.site-nav-inner { display: flex; align-items: center; gap: 24px; height: 60px; max-width: 1152px; margin: 0 auto; padding: 0 24px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font: 700 20px/1 var(--display); letter-spacing: -0.01em; text-decoration: none; border-radius: 6px; }
.brand img { width: 28px; height: 28px; }
.site-nav-links { display: flex; gap: 22px; margin-left: auto; font-size: 15px; }
.site-nav-links a { color: var(--muted); text-decoration: none; border-radius: 4px; }
.site-nav-links a:hover { color: var(--ink); }
.brand:focus-visible, .site-nav-links a:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
@media (max-width: 480px) { .site-nav-inner { padding: 0 16px; height: 56px; } .site-nav-links { gap: 16px; } }

/* ---------- connect card ---------- */

.connect {
  min-height: calc(100% - 61px);
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 32px;
  display: grid;
  gap: 20px;
}
@media (max-width: 480px) { .card { padding: 24px 20px; border-radius: 16px; } }

.card h1 {
  margin: 0;
  font: 700 22px/1.15 var(--display);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.lead { margin: -6px 0 0; color: var(--muted); }

/* Text fields (the account area's UInput look). */
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field-label small { font-weight: 400; font-size: 13px; }
.field-error { margin: 0; color: var(--red-text); font-size: 13.5px; }
.u-input { position: relative; display: block; min-width: 0; }
.input {
  display: block; width: 100%; height: 44px; min-width: 0; padding: 0 12px; margin: 0;
  font: 15.5px/1.3 var(--body); color: var(--ink); background: var(--paper);
  border: 1px solid var(--field-line); border-radius: 10px; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  -webkit-appearance: none; appearance: none;
}
.input::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px var(--focus); }
.input[aria-invalid="true"] { border-color: var(--red-text); }
.input[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 25%, transparent); }
.u-input.has-button .input { padding-right: 46px; }
.input-button {
  position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; display: grid; place-items: center; padding: 0;
  border: 0; border-radius: 8px; background: none; color: var(--muted);
}
.input-button:hover { background: var(--paper-2); color: var(--ink); }
.input-button:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); color: var(--ink); }
.input-button .icon { width: 18px; height: 18px; }
#remote-id { height: 54px; font: 500 24px/1 var(--mono); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
#remote-id::placeholder { letter-spacing: 0.04em; }

/* Buttons (the account area's .abtn). */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 46px; padding: 0 18px;
  border: 1.5px solid transparent; border-radius: 999px; font: 600 15px/1 var(--body); white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--red) 35%, transparent); }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--red-btn); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--red-btn-hover); }
.btn-secondary { background: var(--card); border-color: var(--line); color: var(--ink); }
.btn-secondary:hover:not(:disabled) { border-color: var(--ink); }
.actions { display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; }

.status { margin: -4px 0 0; min-height: 1.4em; color: var(--muted); font-size: 14px; }
.status:empty { display: none; }
.status.error { color: var(--red-text); }

/* Saved password from the address book: a chip instead of the field. */
.saved-pw { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; min-height: 44px; }
.saved-pw-chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px 0 11px; border-radius: 999px;
  background: color-mix(in srgb, var(--ok) 12%, var(--card)); border: 1px solid color-mix(in srgb, var(--ok) 35%, var(--line));
  font-size: 14px; font-weight: 600; color: var(--ink);
}
.saved-pw-chip .icon { width: 16px; height: 16px; color: var(--ok); }
.link-btn { padding: 0; border: 0; background: none; color: var(--red-text); font-size: 13.5px; text-decoration: underline; text-underline-offset: 2px; border-radius: 3px; }
.link-btn:hover { text-decoration-thickness: 2px; }
.link-btn:focus-visible { outline: 2px solid var(--red-text); outline-offset: 2px; }
.field-link { justify-self: start; }

/* Profile: a selection when signed in, otherwise one quiet line. */
.profile-hint { margin: 0; font-size: 14px; color: var(--muted); }
.field-help { margin: 0; font-size: 12.5px; color: var(--muted); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.btn-sm { height: 34px; padding: 0 14px; font-size: 14px; }

/* The computer chosen from the address book, above the form. */
.chosen { display: flex; align-items: center; gap: 10px; padding: 9px 6px 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.chosen-text { display: grid; flex: 1; min-width: 0; line-height: 1.3; }
.chosen-text strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chosen-text span { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chosen-text span:empty { display: none; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; background: var(--field-line); }
.dot-online { background: var(--ok); }
.dot-busy { background: var(--busy); }

/* ---------- address book (signed in) ---------- */

.connect-layout { width: 100%; display: grid; justify-items: center; }
.book {
  display: flex; flex-direction: column; width: 100%; min-width: 0;
  background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); overflow: hidden;
}
.book-head { display: flex; align-items: baseline; gap: 12px; padding: 18px 20px 12px; }
.book-head h2 { margin: 0; font: 700 19px/1.2 var(--display); letter-spacing: -0.01em; }
.book-manage { margin-left: auto; font-size: 13.5px; white-space: nowrap; }
.book .book-close { display: none; align-self: center; }
.book-tools { display: flex; gap: 8px; padding: 0 20px 12px; }
.book-search { flex: 1; min-width: 0; }
.book-search .input { height: 38px; padding-left: 36px; font-size: 14.5px; }
.book-search-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.book-sort { width: 168px; flex: none; }
.book-sort .u-select-trigger { min-height: 38px; }
.book .book-group-select { display: none; flex: 1; min-width: 0; }
.book-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 210px minmax(0, 1fr); border-top: 1px solid var(--line); }
.book-tree { list-style: none; margin: 0; padding: 8px; overflow: auto; border-right: 1px solid var(--line); }
.tree-item {
  display: flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 8px 0 calc(2px + var(--depth, 0) * 14px);
  border-radius: 8px; font-size: 13.5px; cursor: pointer; outline: none;
}
.tree-item:hover { background: var(--paper-2); }
.tree-item.is-selected { background: var(--paper-2); font-weight: 600; }
.tree-item:focus-visible { box-shadow: inset 0 0 0 2px var(--ink); }
.twisty { width: 16px; height: 16px; flex: none; display: grid; place-items: center; color: var(--muted); border-radius: 4px; }
.twisty .icon { width: 12px; height: 12px; transition: transform 0.15s; }
.twisty:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
[aria-expanded="true"] > .twisty .icon { transform: rotate(90deg); }
.tree-icon { width: 15px; height: 15px; color: var(--muted); }
.tree-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count { font-size: 12px; font-weight: 400; color: var(--muted); font-variant-numeric: tabular-nums; }
.book-main { min-height: 0; overflow: auto; }
.book-list { list-style: none; margin: 0; padding: 6px; outline: none; min-height: 100%; }
.book-row { display: flex; align-items: flex-start; gap: 12px; padding: 9px 12px; border-radius: 10px; cursor: pointer; }
.book-row .dot { margin-top: 6px; }
.book-row:hover { background: var(--paper-2); }
.book-row.is-chosen { background: color-mix(in srgb, var(--red) 10%, var(--card)); }
.book-list:focus-visible .book-row.is-active { box-shadow: inset 0 0 0 2px var(--ink); }
.row-main { display: grid; gap: 1px; flex: 1; min-width: 0; }
.row-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.row-name { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-id { font: 12.5px/1.3 var(--mono); color: var(--muted); white-space: nowrap; }
.row-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 3px; }
.tag { padding: 1px 8px; border-radius: 999px; background: var(--paper-2); color: var(--muted); font-size: 11.5px; line-height: 1.5; }
.book-empty { margin: 0; padding: 28px 20px; text-align: center; color: var(--muted); font-size: 14px; }
.book-scrim { position: fixed; inset: 0; z-index: 29; background: rgba(0, 0, 0, 0.45); }

/* Wide windows: the address book beside the form. */
@media (min-width: 1080px) {
  body.has-book .connect-layout { grid-template-columns: minmax(480px, 660px) 420px; justify-content: center; align-items: start; gap: 24px; max-width: 1104px; }
  body.has-book .card { align-self: start; }
  .book { height: min(700px, calc(100vh - 110px)); }
  #book-open, .book-scrim { display: none !important; }
}
/* Narrower: a sheet from the bottom, opened by the "Address book" button. */
@media (max-width: 1079px) {
  .book { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; width: auto; max-width: 760px; margin: 0 auto;
          height: min(88vh, 760px); border-radius: 20px 20px 0 0; border-bottom: 0; padding-bottom: env(safe-area-inset-bottom); }
  .book:not(.open) { display: none; }
  .book .book-close { display: inline-grid; }
  .book-head { padding: 14px 12px 10px 20px; }
  .book-tools { padding: 0 16px 10px; flex-wrap: wrap; }
  .book-search { flex-basis: 100%; }
  .book .book-group-select { display: block; }
  .book-sort { width: 150px; }
  .book-body { grid-template-columns: minmax(0, 1fr); }
  .book-tree { display: none; }
  body.sheet-open { overflow: hidden; }
}
@media (max-width: 480px) {
  .book-sort { width: 132px; }
  .book-head { display: grid; grid-template-columns: 1fr auto; row-gap: 0; }
  .book-manage { grid-row: 2; margin: 0; }
  .book .book-close { grid-column: 2; grid-row: 1 / 3; }
}

/* ---------- dropdown (the account area's USelect) ---------- */

.u-select { position: relative; display: block; min-width: 0; }
.u-select-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 44px; padding: 6px 10px 6px 12px;
  border: 1px solid var(--field-line); border-radius: 10px; background: var(--paper); color: var(--ink);
  font-size: 15px; text-align: left; transition: border-color 0.15s, box-shadow 0.15s;
}
.u-select-trigger:hover { border-color: color-mix(in srgb, var(--ink) 55%, var(--field-line)); }
.u-select-trigger:focus-visible, .u-select-trigger[aria-expanded="true"] { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px var(--focus); }
.u-select-value { display: flex; align-items: center; gap: 10px; min-width: 0; }
.u-select-text { display: grid; min-width: 0; line-height: 1.25; }
.u-select-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-select-label.is-placeholder { color: var(--muted); }
.u-select-sub { font-size: 13px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.u-select-caret { color: var(--muted); transition: transform 0.15s; }
.u-select-trigger[aria-expanded="true"] .u-select-caret { transform: rotate(180deg); }
.u-select-sm .u-select-trigger { min-height: 32px; padding: 3px 8px 3px 10px; font-size: 13px; border-radius: 8px; }
.u-select-sm .u-select-caret { width: 14px; height: 14px; }

.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none; object-fit: cover;
  display: inline-grid; place-items: center; background: var(--paper-2); color: var(--muted);
  font: 700 12px/1 var(--display);
}
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }

/* ---------- popovers: dropdown lists and session menus ---------- */

.popover {
  position: fixed; z-index: 40; min-width: 180px; max-width: calc(100vw - 16px);
  background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); padding: 5px; overflow-y: auto; outline: none;
}
.listbox { margin: 0; list-style: none; }
.option, .menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; border-radius: 8px;
  background: none; color: var(--ink); font-size: 14px; line-height: 1.3; text-align: left; white-space: nowrap; cursor: pointer;
}
.option.is-active, .menu-item:hover, .menu-item:focus-visible { background: var(--paper-2); outline: none; }
.option-text { display: grid; flex: 1; min-width: 0; }
.option-label { overflow: hidden; text-overflow: ellipsis; }
.option-sub { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.option-check { width: 16px; height: 16px; color: var(--red-text); visibility: hidden; flex: none; }
.option[aria-selected="true"] { font-weight: 600; }
.option[aria-selected="true"] .option-check { visibility: visible; }

/* Display menu: radio and check rows. */
.display-menu { width: max-content; min-width: 250px; padding: 8px; display: grid; gap: 1px; }
.menu-heading { margin: 8px 10px 4px; font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }
.menu-heading:first-child { margin-top: 2px; }
.radio-group { display: grid; gap: 1px; }
.choice { gap: 10px; font-size: 14px; }
.choice[aria-disabled="true"] { opacity: 0.5; cursor: default; }
.choice[aria-disabled="true"]:hover { background: none; }
.radio-dot, .check-box {
  position: relative; flex: none; width: 18px; height: 18px; display: grid; place-items: center;
  border: 1.5px solid var(--field-line); background: var(--card); transition: background 0.15s, border-color 0.15s;
}
.radio-dot { border-radius: 50%; }
.radio-dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #fff; transform: scale(0); transition: transform 0.15s; }
[aria-checked="true"] > .radio-dot { background: var(--red-btn); border-color: var(--red-btn); }
[aria-checked="true"] > .radio-dot::after { transform: scale(1); }
.check-box { border-radius: 5px; color: #fff; }
.check-box .icon { width: 12px; height: 12px; opacity: 0; transition: opacity 0.12s; }
[aria-checked="true"] > .check-box { background: var(--red-btn); border-color: var(--red-btn); }
[aria-checked="true"] > .check-box .icon { opacity: 1; }
.menu-select { padding: 2px 4px 4px 38px; }
.menu-select .u-select-trigger { background: var(--card); }
.menu-select.is-active .u-select-trigger { border-color: var(--red-btn); }

/* ---------- tooltip ---------- */

.tooltip {
  position: fixed; z-index: 100; pointer-events: none; max-width: min(22rem, calc(100vw - 16px)); padding: 5px 9px; border-radius: 7px;
  background: var(--tip-bg); color: var(--tip-text); font: 500 12.5px/1.35 var(--body); white-space: pre-line; overflow-wrap: break-word;
  box-shadow: 0 8px 20px -6px rgba(0, 0, 0, 0.4); opacity: 0; transition: opacity 0.1s;
}
.tooltip.visible { opacity: 1; }

/* ---------- session ---------- */

.session { position: fixed; inset: 0; background: #000; }

.stage {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr); /* the picture fills the area inside the strips, no more */
  place-items: center;
  outline: none;
  cursor: default;
  background: #000;
  /* Edge strips around the picture: the pointer reaches the remote screen's bottom (Dock), sides and hot corners
     here without touching this computer's own screen edge (toRemote in viewer.js maps them to the nearest edge). */
  padding: 0 12px 24px;
}

#screen {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.remote-cursor { position: absolute; pointer-events: none; z-index: 1; image-rendering: auto; }

.toolbar {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  margin-inline: auto;
  width: max-content;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 2px;
  max-width: calc(100% - 16px);
  padding: 5px;
  background: var(--bar);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform .2s ease, opacity .2s ease;
  z-index: 4; /* above the side panels and the chat window */
}
.toolbar.hidden { transform: translateY(calc(-100% + 6px)); opacity: .35; }
.tb-btn {
  display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px;
  border: 0; border-radius: 8px; background: none; color: var(--ink); font-size: 13px; font-weight: 500; white-space: nowrap;
}
.tb-btn:hover, .tb-btn[aria-expanded="true"] { background: var(--paper-2); }
.tb-btn:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ink); }
.tb-btn .icon { width: 14px; height: 14px; color: var(--muted); }
.tb-btn.danger { color: var(--red-text); }
.tb-btn.danger:hover { background: var(--red-btn); color: #fff; }
.tb-sep { width: 1px; height: 20px; margin: 0 3px; background: var(--line); }
.tb-select { width: auto; max-width: 280px; }
.tb-select .u-select-trigger { background: transparent; border-color: var(--line); }

.peer { display: inline-flex; align-items: center; padding: 0 8px; height: 32px; font-size: 13px; color: var(--muted); white-space: nowrap; border-radius: 8px; outline: none; }
.peer:focus-visible { box-shadow: inset 0 0 0 2px var(--ink); }
.peer::before {
  content: "";
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--ok);
}

#mic-btn.live { background: var(--red-btn); color: #fff; }

/* Connection statistics: dark in both modes, like the app's statistics panel. Fixed width; moved by its header. */
.stats {
  position: absolute;
  width: 280px;
  max-width: calc(100vw - 16px);
  padding: 0 12px 10px;
  background: rgba(14, 16, 20, 0.78);
  color: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  box-shadow: 0 12px 28px -10px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  font-size: 12px;
  z-index: 3;
  color-scheme: dark;
}
.stats-head { display: flex; align-items: center; gap: 8px; height: 32px; margin: 0 -4px 2px 0; cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; }
.stats-head strong { flex: 1; font-size: 11.5px; font-weight: 600; letter-spacing: 0.02em; }
.stats-close {
  width: 22px; height: 22px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 6px;
  background: none; color: rgba(255, 255, 255, 0.6); font-size: 12px; cursor: pointer;
}
.stats-close:hover, .stats-close:focus-visible { color: #fff; background: rgba(255, 255, 255, 0.12); outline: none; }
.stats-close:focus-visible { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7); }
.stats.is-dragging { box-shadow: 0 20px 40px -12px rgba(0, 0, 0, 0.75); }
.stats-body { margin: 0; display: grid; gap: 2px; }
.stats-row { display: grid; grid-template-columns: 74px minmax(0, 1fr); column-gap: 8px; align-items: baseline; }
.stats-row dt { color: rgba(255, 255, 255, 0.62); }
.stats-row dd { margin: 0; font: 12px/1.5 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-row[data-label="Encrypted"] { margin-top: 6px; padding-top: 6px; border-top: 1px solid rgba(255, 255, 255, 0.12); }
.stats-note { grid-column: 2; margin: 1px 0 0; color: rgba(255, 255, 255, 0.62); font-size: 11.5px; line-height: 1.35; }

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  background: var(--paper);
  z-index: 1;
}

.privacy-notice {
  position: absolute; inset: 0; margin: auto; width: min(420px, 90%); height: fit-content;
  display: flex; flex-direction: column; gap: 6px; text-align: center;
  padding: 20px 24px; border-radius: 16px; background: var(--card); color: var(--ink);
  border: 1px solid var(--line); box-shadow: var(--shadow);
  font-size: 14px; line-height: 1.45; pointer-events: none;
}
.privacy-notice strong { font: 700 17px/1.2 var(--display); }
.privacy-notice span { color: var(--muted); }

/* ---------- side panels: files, chat, computer info ---------- */

.files {
  position: absolute;
  top: 60px;
  right: 8px;
  bottom: 8px;
  width: min(420px, calc(100% - 16px));
  display: flex;
  flex-direction: column;
  background: var(--card);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  z-index: 3;
  font-size: 13px;
  overflow: hidden;
}
.files-bar { display: flex; gap: 4px; align-items: center; padding: 6px 6px 6px 10px; border-bottom: 1px solid var(--line); }
.icon-btn {
  display: inline-grid; place-items: center; flex: none; min-width: 30px; height: 30px; padding: 0 6px;
  border: 0; border-radius: 8px; background: none; color: var(--muted); font-size: 14px;
}
.icon-btn:hover:not(:disabled) { background: var(--paper-2); color: var(--ink); }
.icon-btn:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ink); color: var(--ink); }
.icon-btn:disabled { opacity: 0.4; cursor: default; }
.text-btn { display: inline-flex; align-items: center; height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--ink); font-size: 13px; font-weight: 500; flex: none; }
.text-btn:hover { border-color: var(--ink); }
.text-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--focus); }
.files-path { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: rtl; text-align: left; color: var(--muted); font-family: var(--mono); font-size: 12px; }
.files-bar strong.files-path { direction: ltr; font: 600 14px/1 var(--body); color: var(--ink); }
.files-list, .files-transfers { list-style: none; margin: 0; padding: 4px; overflow: auto; }
.files-list { flex: 1; }
.files-transfers { max-height: 30%; border-top: 1px solid var(--line); }
.files-transfers:empty { display: none; }
.files-list li, .files-transfers li { display: flex; justify-content: space-between; gap: 8px; padding: 5px 8px; border-radius: 6px; cursor: default; white-space: nowrap; overflow: hidden; }
.files-list li:hover { background: var(--paper-2); }
.muted.error, .error { color: var(--red-text); }
.files-head { display: grid; grid-template-columns: 1fr 70px 110px; gap: 8px; padding: 4px 12px; border-bottom: 1px solid var(--line); }
.files-head button { background: none; border: 0; padding: 2px 0; text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); border-radius: 4px; }
.files-head button:hover { color: var(--ink); }
.files-head button:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.files-list li { display: grid; grid-template-columns: 1fr 70px 110px; gap: 8px; }
.fname { overflow: hidden; text-overflow: ellipsis; }
.fsize, .fdate { font-size: 12px; font-variant-numeric: tabular-nums; }

/* Chat: a small floating window, moved by its title bar and sized by its corner grip (Floating in viewer.js). */
.files.floating { top: auto; right: auto; bottom: auto; left: auto; min-width: 0; }
.floating .drag-handle { cursor: move; touch-action: none; user-select: none; -webkit-user-select: none; }
.floating.is-dragging, .floating.is-resizing { user-select: none; -webkit-user-select: none; box-shadow: var(--shadow); }
.resize-grip {
  position: absolute; right: 0; bottom: 0; width: 18px; height: 18px; cursor: nwse-resize; touch-action: none;
  background: linear-gradient(135deg, transparent 0 55%, var(--field-line) 55% 62%, transparent 62% 72%, var(--field-line) 72% 79%, transparent 79%);
  border-bottom-right-radius: var(--radius);
}
.chat-list { flex: 1; list-style: none; margin: 0; padding: 10px; overflow: auto; display: flex; flex-direction: column; gap: 8px; }
.chat-list li { max-width: 85%; display: grid; gap: 2px; }
.chat-list li.mine { align-self: flex-end; text-align: right; }
.chat-list .meta { font-size: 11px; color: var(--muted); }
.chat-list .text { padding: 6px 10px; border-radius: 12px; background: var(--paper-2); white-space: pre-wrap; text-align: left; user-select: text; }
.chat-list li.mine .text { background: var(--red-btn); color: #fff; }
.chat-form { display: flex; gap: 6px; padding: 8px 14px 8px 8px; border-top: 1px solid var(--line); }
.chat-form .input { flex: 1; height: 36px; font-size: 14px; }
.chat-form .btn { height: 36px; padding: 0 14px; font-size: 14px; }

.info-tabs { display: flex; gap: 2px; padding: 6px 8px 0; }
.info-tabs button { height: 28px; padding: 0 10px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 12.5px; font-weight: 500; }
.info-tabs button:hover { color: var(--ink); background: var(--paper-2); }
.info-tabs button.active { background: var(--paper-2); color: var(--ink); }
.info-tabs button:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--ink); }
.info-body { overflow: auto; padding: 10px 14px; display: grid; gap: 12px; align-content: start; }
.info-body h4 { margin: 0 0 3px; font-size: 12px; color: var(--muted); }
.info-body table { border-collapse: collapse; font-size: 13px; }
.info-body td { padding: 1px 12px 1px 0; vertical-align: top; }
.info-body td:first-child { color: var(--muted); white-space: nowrap; }
.info-body td:last-child { user-select: text; word-break: break-word; }
.info-warnings { padding: 8px 10px; border-radius: 8px; background: var(--warn-bg); line-height: 1.6; }
.info-critical { color: var(--red-text); }

/* File-transfer-only session: no remote screen, the file panel fills the window. */
.session.files-only { background: var(--paper); }
.session.files-only .stage { display: none; }
.session.files-only .files { top: 60px; left: 50%; right: auto; transform: translateX(-50%); width: min(720px, calc(100% - 16px)); }
.session.files-only #display-btn, .session.files-only #display-select, .session.files-only #keys-btn,
.session.files-only #fullscreen-btn, .session.files-only #files-close, .session.files-only #send-file-btn,
.session.files-only #mic-btn, .session.files-only .switch-group { display: none !important; }

/* App switcher (⌥Tab or the Apps button): ⌘ held on the remote Mac while it is open. */
.switch-group { display: inline-flex; }
.switch-group #switch-btn[aria-pressed="true"] { background: var(--red-btn); color: #fff; border-radius: 8px 0 0 8px; }
.switch-done { background: var(--red-btn) !important; color: #fff !important; border-radius: 0 8px 8px 0; padding: 0 9px; border-left: 1px solid rgba(255, 255, 255, 0.35); }
.switch-done:hover { background: var(--red-btn-hover) !important; }
.switch-hint {
  position: absolute; top: 60px; left: 0; right: 0; margin-inline: auto; width: max-content; max-width: calc(100% - 16px); z-index: 4;
  padding: 7px 12px; border-radius: 10px; background: rgba(14, 16, 20, 0.85); color: #fff; font-size: 13px; text-align: center;
  box-shadow: 0 8px 20px -8px rgba(0, 0, 0, 0.6); pointer-events: none;
}
.menu-note { margin: 2px 10px 4px; font-size: 12.5px; color: var(--muted); }
.menu-sep { height: 1px; margin: 4px 6px; background: var(--line); }
@media (pointer: coarse) { .switch-hint { top: auto; bottom: calc(76px + env(safe-area-inset-bottom)); left: 8px; right: 72px; width: auto; max-width: none; } }
/* Takes the browser's paste for a moment (see startPaste in viewer.js). */
.paste-sink { position: fixed; left: -10000px; top: 0; width: 1px; height: 1px; opacity: 0; }

/* ---------- phones and tablets: controls behind a floating button, toolbar at the bottom, soft keyboard ---------- */
.touch-controls { display: none; }
.mobile-keys { position: fixed; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; font-size: 16px; resize: none; pointer-events: none; }
@media (pointer: coarse) {
  .stage { touch-action: none; }
  .touch-controls { display: flex; flex-direction: column; gap: 10px; position: absolute; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 3; }
  .touch-controls button { width: 48px; height: 48px; border-radius: 50%; font-size: 20px; padding: 0; background: var(--bar); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow-sm); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
  .touch-controls button.active { background: var(--red-btn); border-color: var(--red-btn); color: #fff; }
  .toolbar { top: auto; bottom: calc(8px + env(safe-area-inset-bottom)); left: 8px; right: 72px; width: auto; margin: 0; transform: none; max-width: none;
             flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .toolbar:not(.open) { display: none; }
  .tb-btn, .peer { height: 42px; padding: 0 12px; font-size: 15px; flex: none; }
  .tb-select { flex: none; }
  .tb-select .u-select-trigger { min-height: 42px; font-size: 15px; }
  .option, .menu-item { padding: 11px 12px; font-size: 15px; }
  .files:not(.floating) { top: 8px; left: 8px; right: 8px; bottom: calc(76px + env(safe-area-inset-bottom)); width: auto; }
}

/* connect.html?debug=keys: the input messages sent (see KeyLog in viewer.js). */
.key-log {
  position: absolute; left: 8px; top: 56px; z-index: 5; width: min(460px, calc(100% - 16px)); max-height: 60%; overflow: hidden;
  margin: 0; padding: 6px 8px; list-style: none; pointer-events: none;
  background: rgba(0, 0, 0, 0.78); color: #9fe8b0; border-radius: 8px; font: 11px/1.45 var(--mono);
}
.key-log li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key-log .key-log-event { color: rgba(255, 255, 255, 0.6); }
