:root {
  --bg: #0f1419; --panel: #182029; --panel2: #1f2a35; --text: #e6edf3; --muted: #93a1b0;
  --line: #2b3745; --accent: #3b82f6; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444;
  font: 15px/1.45 "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
body { display: flex; flex-direction: column; }
[hidden] { display: none !important; }
button, select { font: inherit; color: var(--text); background: var(--panel2); border: 1px solid var(--line);
  border-radius: 6px; padding: 6px 12px; cursor: pointer; }
button:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { background: #7f1d1d; border-color: #991b1b; }
button.link { background: none; border: none; color: var(--muted); padding: 0; text-decoration: underline; }
code { background: var(--panel2); padding: 2px 6px; border-radius: 4px; font-size: 13px; word-break: break-all; }

#topbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 18px;
  border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { font-weight: 600; letter-spacing: .02em; }
.who { color: var(--muted); font-size: 13px; }
main { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#signinView, #listView { padding: 24px; max-width: 900px; width: 100%; margin: 0 auto; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.card.narrow { max-width: 420px; margin: 60px auto; }
h1 { font-size: 20px; margin: 0 0 12px; }
.msg { color: var(--muted); min-height: 1.4em; }
.msg.error { color: var(--bad); }
.list-head { display: flex; justify-content: space-between; align-items: center; }

.machine { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; align-items: center; background: var(--panel);
  border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; }
.machine .name { font-weight: 600; }
.machine .meta { color: var(--muted); font-size: 13px; }
.machine .actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.machine.pending { border-color: var(--warn); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--muted); }
.dot.on { background: var(--ok); }
.code { font: 600 18px ui-monospace, Consolas, monospace; color: var(--warn); }
.help { margin-top: 20px; color: var(--muted); }
.help summary { cursor: pointer; color: var(--text); }

#sessionView { flex: 1; min-height: 0; display: flex; flex-direction: column; }
#toolbar { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--panel);
  border-bottom: 1px solid var(--line); flex-wrap: wrap; font-size: 13px; }
#toolbar button, #toolbar select { padding: 4px 10px; font-size: 13px; }
#toolbar label { color: var(--muted); display: flex; gap: 6px; align-items: center; }
.status { color: var(--muted); }
.spacer { flex: 1; }
#stage { position: relative; flex: 1; min-height: 0; overflow: hidden; background: #000; outline: none;
  display: flex; align-items: center; justify-content: center; }
#stage.actual { overflow: auto; display: block; }
#screen { display: block; image-rendering: auto; cursor: default; touch-action: none; }
#overlay { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px; align-items: center;
  justify-content: center; background: rgba(0,0,0,.6); font-size: 16px; }
#overlay[hidden] { display: none; }
:fullscreen #toolbar { display: none; }
#toolbar button.on { border-color: var(--accent); color: #fff; }

#sessBody { flex: 1; min-height: 0; display: flex; }
#sessBody #stage { flex: 1; min-width: 0; }
#filesPanel { width: 440px; max-width: 50vw; display: flex; flex-direction: column; gap: 8px; padding: 10px;
  background: var(--panel); border-left: 1px solid var(--line); font-size: 13px; min-height: 0; }
#filesPanel.drop { outline: 2px dashed var(--accent); outline-offset: -6px; }
#filesPanel button { padding: 4px 10px; font-size: 13px; }
.fp-head { display: flex; justify-content: space-between; align-items: center; }
.fp-path { display: flex; gap: 6px; }
.fp-path input { flex: 1; min-width: 0; font: 13px ui-monospace, Consolas, monospace; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; }
.fp-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.fp-list { flex: 1; min-height: 120px; overflow: auto; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; }
.fp-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 4px 8px; cursor: default;
  user-select: none; border-bottom: 1px solid #1a222c; }
.fp-row:hover { background: var(--panel2); }
.fp-row.sel { background: #1e3a5f; }
.fp-row.dir .n { font-weight: 600; }
.fp-row.dir .n::before { content: "B8  "; color: var(--muted); }
.fp-row.hid { opacity: .6; }
.fp-row .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-row .s, .fp-row .m { color: var(--muted); white-space: nowrap; }
.fp-empty { padding: 12px; color: var(--muted); }
#fpMsg { margin: 0; min-height: 0; }
#fpTransfers { max-height: 30%; overflow: auto; display: flex; flex-direction: column; gap: 6px; }
.fp-job { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; }
.fp-job-top { display: flex; gap: 8px; align-items: center; }
.fp-job .dir { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.fp-job .nm { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-job .bar { height: 4px; background: var(--panel2); border-radius: 2px; margin: 5px 0 3px; overflow: hidden; }
.fp-job .bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.fp-job.ok .bar i { background: var(--ok); }
.fp-job.fail .bar i { background: var(--bad); }
.fp-job .st { color: var(--muted); font-size: 12px; }
.fp-job.fail .st { color: var(--bad); }
.fp-hint { color: var(--muted); font-size: 12px; margin: 0; }
a.button { display: inline-block; text-decoration: none; font: inherit; border-radius: 6px; padding: 6px 14px;
  border: 1px solid var(--line); color: var(--text); background: var(--panel2); white-space: nowrap; }
a.button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.dl-box { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 12px 0 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; }
.dl-title { color: var(--text); font-weight: 600; }
.dl-meta { font-size: 13px; }
.dl-hash { font: 11px ui-monospace, Consolas, monospace; word-break: break-all; }
