/* BrowserDesk design system */
:root {
  --bg: #f4f6fa; --bg2: #eef1f6; --panel: #ffffff; --panel2: #f7f9fc; --line: #e2e7ef; --line2: #d3dae5;
  --text: #0f1729; --muted: #5d6b82; --faint: #94a0b4;
  --accent: #2563eb; --accent-h: #1d4ed8; --accent-soft: #e8efff; --accent-text: #fff;
  --ok: #16a34a; --ok-soft: #e7f7ee; --warn: #d97706; --warn-soft: #fff4e0; --bad: #dc2626; --bad-soft: #fdecec;
  --shadow: 0 1px 2px rgba(16,24,40,.06), 0 8px 24px rgba(16,24,40,.08);
  --shadow-lg: 0 24px 64px rgba(16,24,40,.22);
  --r: 14px; --r-sm: 9px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  --mono: "Cascadia Mono", ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b0f17; --bg2: #0f141e; --panel: #141a25; --panel2: #1a2130; --line: #253045; --line2: #304059;
    --text: #e8edf6; --muted: #98a4ba; --faint: #66728a;
    --accent: #3b82f6; --accent-h: #2f6fe0; --accent-soft: #172a4d;
    --ok: #22c55e; --ok-soft: #0f2a1b; --warn: #f59e0b; --warn-soft: #2d2210; --bad: #ef4444; --bad-soft: #2e1416;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
    --shadow-lg: 0 24px 64px rgba(0,0,0,.55);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--text); font: 14px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.mono { font-family: var(--mono); }
.grow { flex: 1; min-width: 0; }
.row { display: flex; gap: 8px; align-items: center; }
.wrap { flex-wrap: wrap; }
.mt { margin-top: 14px; }
.acct-list { display: flex; flex-wrap: wrap; gap: 6px; }
.acct { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; background: var(--panel2);
  border: 1px solid var(--line); font-size: 13px; }
.status-list { display: grid; gap: 8px; }
.share-needed { display: grid; gap: 8px; justify-items: start; margin-top: 14px; padding: 14px; border-radius: var(--r-sm);
  background: var(--warn-soft); border: 1px solid color-mix(in srgb, var(--warn) 40%, transparent); }
#fbImg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; touch-action: none; }
#screen.original #fbImg { position: static; width: auto; height: auto; object-fit: none; }
#secureBanner { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 4; display: flex; gap: 8px;
  align-items: center; padding: 6px 14px; border-radius: 99px; background: rgba(217,119,6,.92); color: #fff; font-size: 13px;
  font-weight: 600; pointer-events: none; box-shadow: 0 4px 16px rgba(0,0,0,.4); }
.user-chip { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: var(--r-sm); background: var(--panel);
  border: 1px solid var(--line); }
.user-chip img, .user-chip .avatar { width: 40px; height: 40px; border-radius: 50%; }
.device { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r); border: 1px solid var(--line);
  background: var(--panel); box-shadow: var(--shadow); margin-top: 16px; }
.device .dev-ico { width: 46px; height: 46px; border-radius: 12px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
#gbtn { min-height: 44px; margin-top: 18px; display: flex; justify-content: center; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 14px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.rel { position: relative; }
.panel { width: 100%; max-width: 400px; }
.rel .menu { right: 0; }
#go { width: 100%; margin-top: 22px; }
.feat p { margin: 0; }
details summary { cursor: pointer; font-size: 13px; }
.ico { width: 18px; height: 18px; flex: none; }
.ico.sm { width: 15px; height: 15px; } .ico.lg { width: 22px; height: 22px; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; padding: 0 14px;
  background: var(--panel); border: 1px solid var(--line2); border-radius: var(--r-sm); cursor: pointer;
  font-weight: 550; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s; }
.btn:hover { background: var(--panel2); border-color: var(--faint); }
.btn:focus-visible, .ibtn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-h); }
.btn.danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line2)); }
.btn.danger:hover { background: var(--bad-soft); }
.btn.solid-danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.solid-danger:hover { filter: brightness(.92); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel2); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 44px; font-size: 15px; }
.btn:disabled { opacity: .45; pointer-events: none; }
.ibtn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm);
  background: transparent; border: 1px solid transparent; cursor: pointer; color: var(--muted); }
.ibtn:hover { background: var(--panel2); color: var(--text); }

/* ---------- forms ---------- */
label.lbl { display: block; margin: 16px 0 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.input, select.input, textarea.input { width: 100%; height: 40px; background: var(--panel); border: 1px solid var(--line2);
  border-radius: var(--r-sm); padding: 0 12px; outline: none; transition: border-color .12s, box-shadow .12s; }
textarea.input { height: auto; padding: 9px 12px; resize: none; line-height: 1.45; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); outline: none; }

/* toggle switch */
.toggle { display: flex; align-items: center; gap: 12px; padding: 12px 0; cursor: pointer; border-top: 1px solid var(--line); }
.toggle:first-of-type { border-top: 0; }
.toggle .t-txt { flex: 1; }
.toggle .t-txt b { display: block; font-weight: 600; }
.toggle .t-txt span { color: var(--muted); font-size: 13px; }
.toggle input { appearance: none; width: 40px; height: 23px; border-radius: 99px; background: var(--line2);
  position: relative; cursor: pointer; transition: background .15s; flex: none; margin: 0; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3); transition: transform .15s; }
.toggle input:checked { background: var(--accent); }
.toggle input:checked::after { transform: translateX(17px); }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.badge.bad { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.plain::before { display: none; }
.count { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--bad); color: #fff;
  font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.card-h h3 { margin: 0; font-size: 15px; font-weight: 650; flex: 1; }
.card-h .ico { color: var(--accent); }
.card-b { padding: 18px 20px; }

/* ---------- app header ---------- */
.appbar { height: 60px; display: flex; align-items: center; gap: 14px; padding: 0 24px; background: var(--panel);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; letter-spacing: -.01em; }
.brand .logo { width: 30px; height: 30px; padding: 5px; border-radius: 8px; background: var(--accent); color: #fff; }
.brand small { font-weight: 500; color: var(--muted); font-size: 13px; }

/* ---------- host dashboard ---------- */
.dash { max-width: 1180px; margin: 0 auto; padding: 24px; display: grid; gap: 20px;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); align-items: start; }
.dash .col { display: grid; gap: 20px; }
@media (max-width: 900px) { .dash { grid-template-columns: minmax(0, 1fr); padding: 16px; } .appbar { padding: 0 16px; } }
.id-hero { padding: 22px 20px 6px; }
.kv { display: grid; gap: 4px; margin-bottom: 16px; }
.kv .k { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kv .v { display: flex; align-items: center; gap: 6px; }
.big-code { font: 650 28px/1.2 var(--mono); letter-spacing: .06em; }
.url-line { font: 500 15px/1.6 var(--mono); }
.fp { font: 11px/1.5 var(--mono); color: var(--faint); word-break: break-all; }
.session-box { display: flex; align-items: center; gap: 14px; padding: 16px; border-radius: var(--r-sm); background: var(--panel2); border: 1px solid var(--line); }
.avatar { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  background: var(--accent-soft); color: var(--accent); flex: none; }
#preview { width: 100%; border-radius: var(--r-sm); background: #000; margin-top: 14px; aspect-ratio: 16/9; display: block; }
.activity { list-style: none; margin: 0; padding: 0; max-height: 260px; overflow: auto; }
.activity li { display: flex; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 13px; }
.activity li:first-child { border-top: 0; }
.activity time { color: var(--faint); font: 12px var(--mono); flex: none; padding-top: 1px; }
.activity .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); margin-top: 6px; flex: none; }
.activity .ok .dot { background: var(--ok); } .activity .warn .dot { background: var(--warn); }
.empty { color: var(--faint); text-align: center; padding: 18px 0; font-size: 13px; }

/* ---------- chat ---------- */
.chat { display: flex; flex-direction: column; min-height: 0; }
.chat-log { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; min-height: 160px; }
.bubble { max-width: 82%; padding: 8px 12px; border-radius: 14px; background: var(--panel2); border: 1px solid var(--line);
  white-space: pre-wrap; word-wrap: break-word; align-self: flex-start; }
.bubble.me { align-self: flex-end; background: var(--accent); border-color: var(--accent); color: #fff; }
.bubble .meta { display: block; font-size: 11px; opacity: .7; margin-bottom: 2px; }
.chat-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); align-items: flex-end; }
.chat-form textarea { max-height: 120px; }

/* ---------- login (viewer) ---------- */
.login { min-height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .hero { background: linear-gradient(145deg, #1e3a8a, #2563eb 55%, #3b82f6); color: #fff; padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between; }
.login .hero h1 { font-size: 34px; line-height: 1.15; margin: 0 0 14px; letter-spacing: -.02em; }
.login .hero p { opacity: .85; max-width: 420px; font-size: 15px; }
.login .hero .brand .logo { background: rgba(255,255,255,.18); }
.feat { display: grid; gap: 14px; margin-top: 28px; }
.feat div { display: flex; gap: 12px; align-items: flex-start; }
.feat .ico { width: 20px; height: 20px; margin-top: 2px; opacity: .9; }
.feat b { display: block; } .feat span { opacity: .78; font-size: 13.5px; }
.login .side { display: grid; place-items: center; padding: 32px 16px; }
.login form { width: 100%; max-width: 380px; }
.login h2 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.01em; }
.pw-input { font: 600 20px var(--mono); letter-spacing: .12em; height: 50px; text-align: center; }
.msg { margin-top: 14px; min-height: 22px; font-size: 13.5px; display: flex; gap: 8px; align-items: center; }
.msg.err { color: var(--bad); } .msg.ok { color: var(--muted); }
.spinner { width: 16px; height: 16px; border: 2px solid var(--line2); border-top-color: var(--accent); border-radius: 50%;
  animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 820px) { .login { grid-template-columns: 1fr; } .login .hero { padding: 28px 20px; } .login .hero .feat, .login .hero .foot { display: none; } }

/* ---------- viewer session ---------- */
#stage { position: fixed; inset: 0; display: flex; flex-direction: column; background: #05070b; color: #e8edf6; }
#bar, #chatPane { color-scheme: dark; --panel: #111723; --panel2: #1b2333; --line: #222c3d; --line2: #2c3850;
  --text: #e8edf6; --muted: #a3afc4; --faint: #6b7890; --accent-soft: #172a4d; }
#bar { height: 50px; display: flex; align-items: center; gap: 4px; padding: 0 10px; background: #111723;
  border-bottom: 1px solid #222c3d; z-index: 6; transition: transform .2s; color-scheme: dark;
  --panel: #111723; --panel2: #1b2333; --line: #222c3d; --line2: #2c3850; --text: #e8edf6; --muted: #a3afc4; --faint: #6b7890; }
#bar .sep { width: 1px; height: 24px; background: #2a3549; margin: 0 6px; }
.tb { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 10px; border-radius: 8px;
  background: transparent; border: 0; color: #c8d1e0; cursor: pointer; font-size: 13px; font-weight: 550; position: relative; white-space: nowrap; }
.tb:hover, .tb.on { background: #1f2a3d; color: #fff; }
.tb.on { color: #8fb6ff; }
.tb:disabled { opacity: .35; pointer-events: none; }
.tb.hang { background: #b91c1c; color: #fff; margin-left: 4px; }
.tb.hang:hover { background: #dc2626; }
.tb .count { position: absolute; top: 2px; right: 0; }
.host-name { display: flex; align-items: center; gap: 8px; padding: 0 8px; font-weight: 600; min-width: 0; }
.qdot { width: 9px; height: 9px; border-radius: 50%; background: #64748b; flex: none; }
.qdot.ok { background: #22c55e; box-shadow: 0 0 8px #22c55e; } .qdot.warn { background: #f59e0b; } .qdot.bad { background: #ef4444; }
#stats { font: 12px var(--mono); color: #8a96ab; padding: 0 6px; white-space: nowrap; }
#timer { font: 12px var(--mono); color: #8a96ab; }
@media (max-width: 1100px) { .tb .lbl { display: none; } #stats { display: none; } }

.menu { position: absolute; top: 46px; min-width: 290px; background: #161e2c; border: 1px solid #2a3549; border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,.5); padding: 6px; z-index: 30; }
.menu button { display: flex; width: 100%; align-items: center; gap: 10px; padding: 9px 10px; border: 0; background: transparent;
  color: #dbe3f0; border-radius: 8px; cursor: pointer; text-align: left; font-size: 13.5px; }
.menu button:hover { background: #22304a; }
.menu button kbd { margin-left: auto; font: 11px var(--mono); color: #7f8ba1; }
.menu button.sel::after { content: "✓"; margin-left: auto; color: #8fb6ff; }
.menu hr { border: 0; border-top: 1px solid #263147; margin: 6px 4px; }
.menu .mh { padding: 6px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b7890; }

#main { flex: 1; min-height: 0; display: flex; }
#screen { flex: 1; min-width: 0; position: relative; outline: none; overflow: hidden; }
#screen.original { overflow: auto; }
#video { width: 100%; height: 100%; object-fit: contain; display: block; touch-action: none; background: #000; }
#screen.original #video { width: auto; height: auto; max-width: none; object-fit: none; }
#status { position: absolute; inset: 0; display: grid; place-items: center; color: #8a96ab; pointer-events: none; font-size: 15px; }
#status .row { gap: 12px; }
#dropzone { position: absolute; inset: 14px; border: 2px dashed #60a5fa; border-radius: 16px; background: rgba(37,99,235,.18);
  display: grid; place-items: center; color: #fff; font-size: 18px; font-weight: 600; pointer-events: none; z-index: 5; }

#stage:fullscreen #bar { position: absolute; top: 0; left: 0; right: 0; transform: translateY(-100%); }
#stage:fullscreen #bar:hover, #stage:fullscreen #bar.peek, #stage:fullscreen #bar:focus-within { transform: none; }
#hotzone { position: absolute; top: 0; left: 0; right: 0; height: 6px; z-index: 7; display: none; }
#stage:fullscreen #hotzone { display: block; }

/* side drawer (chat) inside session */
.drawer { width: 340px; flex: none; background: var(--panel); color: var(--text); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; }
.drawer .card-h { padding: 12px 14px; }

/* ---------- modal ---------- */
.overlay { position: fixed; inset: 0; background: rgba(8,12,20,.55); backdrop-filter: blur(3px); display: grid;
  place-items: center; padding: 16px; z-index: 50; }
.dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow-lg); width: 100%; max-width: 440px; animation: pop .16s ease-out; overflow: hidden; }
.dialog .card-b { padding: 22px; }
.dialog-f { display: flex; gap: 10px; padding: 14px 22px; background: var(--panel2); border-top: 1px solid var(--line); justify-content: flex-end; }
@keyframes pop { from { transform: translateY(6px) scale(.98); opacity: 0; } }

/* ---------- file manager ---------- */
.fm { max-width: 1080px; height: min(760px, 92vh); display: flex; flex-direction: column; }
.fm-tools { display: flex; align-items: center; gap: 6px; padding: 10px 14px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.fm-tools .vsep { width: 1px; height: 22px; background: var(--line); margin: 0 4px; }
.fm-body { flex: 1; min-height: 0; display: flex; }
.fm-side { width: 210px; flex: none; border-right: 1px solid var(--line); padding: 10px 8px; overflow: auto; background: var(--panel2); }
.fm-side .mh { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); }
.place { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: none; border-radius: 8px;
  cursor: pointer; text-align: left; color: var(--text); font-size: 13.5px; }
.place:hover { background: var(--line); } .place.sel { background: var(--accent-soft); color: var(--accent); }
.place .ico { color: var(--muted); } .place.sel .ico { color: var(--accent); }
.place small { display: block; color: var(--faint); font-size: 11px; }
.fm-main { flex: 1; min-width: 0; display: flex; flex-direction: column; position: relative; }
.crumbs { display: flex; align-items: center; gap: 2px; padding: 8px 14px; border-bottom: 1px solid var(--line); overflow-x: auto; white-space: nowrap; font-size: 13px; }
.crumbs button { border: 0; background: none; padding: 4px 6px; border-radius: 6px; cursor: pointer; color: var(--muted); }
.crumbs button:hover { background: var(--panel2); color: var(--text); }
.crumbs button:last-child { color: var(--text); font-weight: 600; }
.crumbs .ico { color: var(--faint); width: 14px; height: 14px; }
.fm-list { flex: 1; overflow: auto; }
.fm-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.fm-table th { position: sticky; top: 0; background: var(--panel); text-align: left; font-weight: 600; color: var(--muted);
  font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; z-index: 1; }
.fm-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.fm-table tr.item { cursor: default; user-select: none; }
.fm-table tr.item:hover td { background: var(--panel2); }
.fm-table tr.item.sel td { background: var(--accent-soft); }
.fm-table td.name { width: 100%; max-width: 0; }
.fm-table td.name .nm { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fm-table td.name span { overflow: hidden; text-overflow: ellipsis; }
.fm-table th.num { text-align: right; }
.fm-table .hid { opacity: .55; }
.fm-table .ico.f-dir { color: #eab308; }
.fm-table .ico.f-img { color: #a855f7; } .fm-table .ico.f-doc { color: #2563eb; } .fm-table .ico.f-zip { color: #d97706; }
.fm-table .ico.f-vid { color: #db2777; } .fm-table .ico.f-mus { color: #0891b2; } .fm-table .ico.f-code { color: #16a34a; }
.fm-table .ico.f-app { color: #64748b; } .fm-table .ico.f-file { color: var(--faint); }
.num { text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.fm-status { padding: 8px 14px; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); display: flex; gap: 12px; }
.fm-search { width: 200px; height: 32px; }
.fm-drop { position: absolute; inset: 10px; border: 2px dashed var(--accent); border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, transparent);
  display: grid; place-items: center; font-weight: 600; color: var(--accent); pointer-events: none; z-index: 3; font-size: 16px; }
@media (max-width: 760px) { .fm-side { display: none; } .fm-search { width: 130px; } }

/* transfers */
.transfers { border-top: 1px solid var(--line); max-height: 170px; overflow: auto; background: var(--panel2); }
.tx { display: grid; grid-template-columns: 22px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 14px; font-size: 13px; border-top: 1px solid var(--line); }
.tx:first-child { border-top: 0; }
.tx .bar { grid-column: 2 / 5; height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.tx .bar i { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.tx.done .bar i { background: var(--ok); } .tx.err .bar i { background: var(--bad); width: 100% !important; }
.tx .ico.dl { color: var(--ok); } .tx .ico.ul { color: var(--accent); }

/* ---------- toasts ---------- */
#toasts { position: fixed; right: 16px; bottom: 80px; display: grid; gap: 8px; z-index: 100; max-width: min(380px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; background: var(--panel); color: var(--text); border: 1px solid var(--line);
  border-left: 4px solid var(--accent); border-radius: 10px; padding: 11px 14px; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: pop .18s ease-out; }
.toast.ok { border-left-color: var(--ok); } .toast.warn { border-left-color: var(--warn); } .toast.bad { border-left-color: var(--bad); }
.toast .grow b { display: block; }
.toast a, .linkish { color: var(--accent); font-weight: 600; cursor: pointer; text-decoration: none; background: none; border: 0; padding: 0; }

/* ---------- remote screen: canvas with zoom/pan ---------- */
#screen { touch-action: none; -webkit-user-select: none; user-select: none; }
#view { position: absolute; inset: 0; overflow: hidden; }
#canvas { position: absolute; left: 0; top: 0; image-rendering: auto; touch-action: none; cursor: default; }
#zoomBadge { position: absolute; right: 12px; bottom: 12px; z-index: 4; padding: 4px 10px; border-radius: 99px;
  background: rgba(17,23,35,.85); color: #e8edf6; font: 600 12px var(--font); pointer-events: none; }
#kbd { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0;
  font-size: 16px; /* no iOS zoom on focus */ resize: none; color: transparent; background: transparent; caret-color: transparent; }
.zoomrow { display: flex; align-items: center; gap: 6px; padding: 4px 6px; }
.zoomrow button { width: 38px; justify-content: center; font-size: 18px; font-weight: 700; background: #1f2a3d !important; }
.zoomrow span { flex: 1; text-align: center; font: 600 13px var(--mono); color: #dbe3f0; }
#mkeys { display: flex; gap: 6px; padding: 6px 8px; overflow-x: auto; background: #0d131d; border-bottom: 1px solid #222c3d;
  scrollbar-width: none; flex: none; }
#mkeys::-webkit-scrollbar { display: none; }
#mkeys button { flex: none; min-width: 44px; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid #2c3850;
  background: #1b2333; color: #e8edf6; font: 600 13px var(--font); }
#mkeys button.on { background: var(--accent); border-color: var(--accent); }
#barToggle { position: absolute; top: 6px; right: 8px; z-index: 8; width: 40px; height: 32px; border-radius: 10px; border: 0;
  background: rgba(17,23,35,.8); color: #fff; display: grid; place-items: center; }

/* ---------- phones & tablets ---------- */
@media (max-width: 760px), (pointer: coarse) {
  #bar { height: auto; min-height: 50px; overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; padding: 4px 6px;
    padding-top: max(4px, env(safe-area-inset-top)); }
  #bar::-webkit-scrollbar { display: none; }
  #bar .grow, #timer, #viewOnly { display: none; }
  .tb { padding: 0 9px; height: 40px; }
  .tb .lbl, .tb .ico.sm { display: none; }
  .host-name { max-width: 110px; }
  .menu { position: fixed; top: auto !important; bottom: 0; left: 0 !important; right: 0 !important; min-width: 0;
    border-radius: 16px 16px 0 0; max-height: 70vh; overflow: auto; padding-bottom: max(10px, env(safe-area-inset-bottom)); }
  .menu button { padding: 13px 12px; font-size: 15px; }
  .drawer { position: absolute; inset: 0; width: auto; z-index: 20; }
  #main { position: relative; }
  .overlay { padding: 0; }
  .dialog.fm { height: 100dvh; max-height: none; border-radius: 0; }
  .fm-tools { gap: 4px; }
  .fm-tools .btn.sm { padding: 0 8px; }
  #toasts { bottom: 12px; left: 12px; right: 12px; max-width: none; }
}
#stage.nobar #bar { display: none; }
#stage.nobar #barToggle { display: grid !important; }
#aGo { width: 100%; margin-top: 22px; }
.wait-box { display: flex; gap: 12px; align-items: flex-start; margin-top: 16px; padding: 14px; border-radius: var(--r-sm);
  background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent); font-size: 13.5px; }
.wait-box b { display: block; margin-bottom: 4px; }
.wait-box .spinner { margin-top: 2px; }
.dev-list { list-style: none; margin: 0; padding: 0; }
.dev-list li { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.dev-list li:first-child { border-top: 0; }
.dev-list .ico { color: var(--muted); }
.dev-pending { background: var(--warn-soft); border-radius: var(--r-sm); padding: 10px 12px !important; border: 0 !important; margin-bottom: 8px; }
h4.sub { margin: 18px 0 6px; font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
h4.sub .muted { text-transform: none; letter-spacing: 0; font-weight: 500; }
