:root {
  --bg: #f6f7f9;
  --fg: #1b1f24;
  --muted: #646d78;
  --card: #ffffff;
  --line: #dde1e6;
  --accent: #2f6fde;
  --accent-fg: #ffffff;
  --ok: #1f9d55;
  --off: #9aa3ad;
  --error: #c62828;
  --term-bg: #0d1117;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --fg: #e4e7eb;
    --muted: #8b949e;
    --card: #161b22;
    --line: #2a313a;
    --accent: #4c8dff;
    --ok: #3fb950;
    --off: #6e7681;
    --error: #ff6b6b;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg); color: var(--fg);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", sans-serif;
  display: flex; flex-direction: column;
}
header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--card);
}
.brand { font-weight: 650; letter-spacing: .02em; }
.who { margin-left: auto; color: var(--muted); }
main { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 16px; }
h1 { font-size: 20px; margin: 0 0 12px; }
[hidden] { display: none !important; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 20px; }
.narrow { width: 100%; max-width: 360px; margin: 8vh auto 0; }
form label { display: block; margin-bottom: 12px; font-size: 14px; color: var(--muted); }
input {
  display: block; width: 100%; margin-top: 4px; padding: 8px 10px; font: inherit; color: var(--fg);
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button {
  font: inherit; padding: 7px 14px; border-radius: 6px; cursor: pointer;
  border: 1px solid var(--accent); background: var(--accent); color: var(--accent-fg);
}
button:disabled { opacity: .5; cursor: default; }
button.link { background: none; border: none; color: var(--accent); padding: 4px 6px; }
#login-form button[type=submit] { width: 100%; margin-top: 4px; }
.error { color: var(--error); min-height: 1.2em; margin: 10px 0 0; font-size: 14px; }
.muted { color: var(--muted); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }

.row { display: flex; align-items: baseline; gap: 8px; }
.row h1 { margin-right: auto; }
.devices { list-style: none; margin: 0; padding: 0; max-width: 760px; }
.devices li {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; margin-bottom: 8px;
  background: var(--card); border: 1px solid var(--line); border-radius: 10px;
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--off); flex: none; }
.dot.on { background: var(--ok); }
.dev-name { font-weight: 600; }
.dev-meta { color: var(--muted); font-size: 13px; margin-right: auto; }

.term-view { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: -16px; }
.term-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--card);
}
.term-title { font-weight: 600; }
.term-status { color: var(--muted); font-size: 13px; margin-right: auto; }
.terminal { flex: 1; min-height: 0; background: var(--term-bg); padding: 6px; }

.display {
  flex: 1; min-height: 0; overflow: hidden; background: #000; outline: none;
  display: flex; align-items: flex-start; justify-content: flex-start;
}
.display > div { cursor: default; }
dialog {
  border: 1px solid var(--line); border-radius: 10px; padding: 20px;
  background: var(--card); color: var(--fg); width: min(360px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { font-size: 18px; margin: 0 0 4px; }
.small { font-size: 13px; }
.row-end { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.clip-panel {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--card);
}
.clip-panel textarea {
  width: 100%; resize: vertical; padding: 8px 10px; border-radius: 6px;
  font: 13px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--fg); background: var(--bg); border: 1px solid var(--line);
}
.clip-panel textarea[readonly] { opacity: .85; }
.clip-actions { display: flex; align-items: center; gap: 8px; }
.clip-actions span { margin-right: auto; }
#desk-clip.flash { text-decoration: underline; }
.files-dialog { width: min(760px, calc(100vw - 32px)); padding: 16px 18px; }
.files-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.files-head h2 { margin: 0; }
.crumbs { margin-right: auto; font-size: 14px; }
.crumbs button { padding: 2px 4px; }
.button-like {
  display: inline-block; padding: 7px 14px; border-radius: 6px; cursor: pointer;
  background: var(--accent); color: var(--accent-fg); border: 1px solid var(--accent);
}
.files-drop {
  max-height: 55vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px;
}
.files-drop.over { outline: 2px dashed var(--accent); outline-offset: -4px; }
.files-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.files-table th {
  text-align: left; font-weight: 600; color: var(--muted); font-size: 12px;
  position: sticky; top: 0; background: var(--card); padding: 6px 10px; border-bottom: 1px solid var(--line);
}
.files-table td { padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.files-table td:first-child { white-space: normal; word-break: break-all; }
.files-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.files-table button.link, .files-table a { padding: 0; text-align: left; color: var(--accent); }
.files-empty { padding: 10px; }
.files-progress { height: 6px; background: var(--line); border-radius: 3px; margin-top: 10px; overflow: hidden; }
#files-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 6px 0 12px; flex-wrap: wrap; }
.tabs button {
  background: none; border: none; color: var(--muted); padding: 8px 12px; border-radius: 0;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }
#view-admin { max-width: 1100px; }
#view-admin .row { align-items: center; }
#view-admin .row h1 { margin: 0 auto 0 0; }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
table.grid th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
table.grid td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.grid tr:last-child td { border-bottom: none; }
table.grid td.actions { text-align: right; white-space: nowrap; }
table.grid code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
table.grid .dot { display: inline-block; vertical-align: middle; margin: -2px 6px 0 0; }
td.detail { color: var(--muted); font-size: 13px; word-break: break-word; }
.row-end.left { justify-content: flex-start; margin: 0 0 10px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.inline-form select { min-width: 140px; }
fieldset.caps { border: none; padding: 0; margin: 0 0 12px; }
label.check { display: inline-flex; gap: 6px; align-items: center; margin-right: 14px; color: var(--fg); }
label.check input { width: auto; margin: 0; }
pre.cmd {
  background: var(--bg); border: 1px solid var(--line); border-radius: 6px; padding: 10px;
  white-space: pre-wrap; word-break: break-all; font-size: 12px;
}
.danger { color: var(--error) !important; }
h2.section { font-size: 15px; color: var(--muted); font-weight: 600; margin: 18px 0 8px; }
.share-row { display: flex; gap: 8px; align-items: center; }
.share-row input { margin-top: 0; flex: 1; min-width: 0; }
select {
  font: inherit; padding: 7px 8px; border-radius: 6px; color: var(--fg);
  background: var(--bg); border: 1px solid var(--line);
}
ul.plain { list-style: none; margin: 8px 0; padding: 0; }
ul.plain li { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.plain li span:first-child { margin-right: auto; }
.badge {
  font-size: 12px; padding: 1px 7px; border-radius: 10px; border: 1px solid var(--line); color: var(--muted);
}
