/* Thiết bị (device farm): list of phones, live screen, tools. Uses the tokens of style.css. */
.dev-page { display: flex; flex-direction: column; gap: 16px; }
.dev-page .page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.dev-page .page-head h1 { margin: 4px 0; font-size: 22px; }
.dev-page .page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dev-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.dev-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; }
.dev-card.mine { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; }
.dev-card-head { display: flex; align-items: center; gap: 8px; }
.dev-card-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; flex-wrap: wrap; }
.dev-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); flex: none; }
.dev-dot.online { background: var(--ok); }
.dev-dot.vpn, .dev-dot.unauthorized { background: var(--warn); }
.grow { flex: 1; min-width: 0; }
.btn.tiny { padding: 2px 7px; font-size: 12px; border-radius: 6px; }
.hidden-file { display: none; }
.row-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 6px 0; }
.row-form > input, .row-form > select { width: auto; min-width: 0; margin: 0; }
.row-form > .grow { flex: 1 1 180px; }
.dev-split { display: grid; grid-template-columns: minmax(260px, auto) minmax(300px, 1fr); gap: 16px; align-items: start; }
.dev-screen-col { display: flex; flex-direction: column; gap: 8px; align-items: center; position: sticky; top: 12px; }
.dev-screen { position: relative; background: #000; border-radius: 18px; padding: 8px; box-shadow: var(--shadow-card); line-height: 0; }
.dev-screen.drop { outline: 3px dashed var(--brand); outline-offset: 4px; }
.dev-canvas { display: block; max-height: calc(100vh - 230px); max-width: min(46vw, 520px); width: auto; height: auto; border-radius: 12px; touch-action: none; cursor: pointer; background: #111; }
.dev-canvas:focus { outline: 2px solid var(--brand); outline-offset: 2px; }
.dev-overlay { position: absolute; inset: 8px; display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; text-align: center; padding: 16px;
  color: #fff; background: rgba(0, 0, 0, .72); border-radius: 12px; font-size: 14px; line-height: 1.4; }
.dev-overlay[hidden] { display: none; }
.dev-screen-off { position: absolute; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; gap: 10px; align-items: center; white-space: nowrap;
  background: rgba(0, 0, 0, .8); color: #fff; font-size: 13px; line-height: 1.3; padding: 8px 10px 8px 14px; border-radius: 999px; }
.dev-screen-col.dev-full { position: fixed; inset: 0; z-index: 1000; justify-content: center; gap: 8px; background: #000;
  padding: max(6px, env(safe-area-inset-top)) max(6px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(6px, env(safe-area-inset-left)); }
.dev-full .dev-screen { padding: 0; box-shadow: none; border-radius: 0; background: transparent; }
.dev-full .dev-canvas { max-width: 100%; border-radius: 6px; } /* max-height set from the visible height in JS */
.dev-full .dev-toolbar { max-width: 100%; flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.dev-full .dev-toolbar > * { flex: none; }
.dev-full .dev-stats { color: #bbb; }
.dev-full .dev-fs-btn { order: -1; }
html.dev-full-open, html.dev-full-open body { overflow: hidden; }
/* centred when it fits, scrolls from the first button when it does not (auto margins collapse to 0) */
.dev-full .dev-toolbar > :first-child { margin-left: auto; }
.dev-full .dev-toolbar > :last-child { margin-right: auto; }
.dev-toolbar { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; max-width: 540px; }
.dev-stats { min-width: 110px; text-align: center; }
.dev-tools { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.dev-tool { padding: 12px 14px; }
.dev-tool h3 { margin: 0 0 6px; font-size: 14px; }
.dev-log { max-height: 340px; overflow: auto; white-space: pre-wrap; word-break: break-all; font-size: 11.5px; line-height: 1.45; background: var(--page); border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin: 8px 0 0; }
.dev-apps { display: flex; flex-direction: column; gap: 4px; max-height: 320px; overflow: auto; }
.dev-app { display: flex; gap: 4px; align-items: center; }
.dev-builds { width: 100%; border-collapse: collapse; font-size: 13px; }
.dev-builds th, .dev-builds td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.dev-steps { padding-left: 20px; line-height: 1.6; }
.dev-steps code { font-size: 12px; word-break: break-all; }
.dev-qr-wrap { display: flex; justify-content: center; margin: 8px 0; }
.dev-qr { width: 260px; height: 260px; image-rendering: pixelated; border-radius: 8px; }
.dev-menu { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; }
.dev-form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 900px) {
  .dev-split { grid-template-columns: 1fr; }
  .dev-screen-col { position: static; }
  .dev-canvas { max-width: 92vw; max-height: 70vh; max-height: 70dvh; }
  .dev-form-grid { grid-template-columns: 1fr; }
}
/* Máy tính (remote desktop, desktops.js): the desktop takes all the room left in the page (main.wide is a 100vh
   flex column); same fullscreen as the phone screen */
.desk-page { flex: 1; min-height: 0; gap: 8px; }
.desk-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-height: 28px; }
.desk-frame { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; }
.desk-box { position: relative; flex: 1; min-height: 200px; background: #000; border-radius: 8px; overflow: hidden; }
.desk-screen { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; outline: none; touch-action: none; }
.desk-screen:focus-visible { box-shadow: inset 0 0 0 2px var(--brand); }
.desk-screen > div { flex: none; }
.desk-toolbar { max-width: none; flex: none; gap: 4px; }
.desk-head .desk-toolbar { justify-content: flex-end; }
.desk-head .desk-toolbar .btn.small { padding: 3px 9px; }
.desk-grants { display: flex; flex-direction: column; gap: 2px; margin: 8px 0; max-height: 50vh; overflow: auto; }
/* A screen that keeps its own size (watching, Ubuntu/xrdp): the box takes its shape */
.desk-box.fixed-aspect { flex: 0 1 auto; aspect-ratio: var(--ar); max-height: 100%; min-height: 0; }
.desk-frame.dev-full { position: fixed; inset: 0; z-index: 1000; background: #000; gap: 6px;
  padding: max(4px, env(safe-area-inset-top)) max(4px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); }
.desk-frame.dev-full .desk-box, .desk-frame.dev-full .desk-box.fixed-aspect { flex: 1; max-height: none; aspect-ratio: auto; min-height: 0; border-radius: 0; }
@media (max-width: 960px) {
  .desk-box { flex: none; height: calc(100vh - 230px); height: calc(100dvh - 230px); }
  .desk-box.fixed-aspect { height: auto; max-height: calc(100dvh - 230px); }
}
/* Máy tính: machine list */
.desk-list .page-head p { margin: 2px 0 0; }
.desk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 14px; }
.desk-card { display: flex; flex-direction: column; gap: 12px; padding: 16px 18px 14px; transition: border-color .15s, box-shadow .15s; }
.desk-card:hover { border-color: var(--line-strong); }
.desk-card-top { display: flex; align-items: flex-start; gap: 12px; }
.desk-os { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; background: var(--brand-soft); color: var(--brand); }
.desk-os.ubuntu { background: var(--warn-soft); color: var(--warn); }
.desk-os.other { background: var(--surface-2); color: var(--text-2); }
.desk-os svg { width: 20px; height: 20px; }
.desk-os.big { width: 48px; height: 48px; border-radius: 14px; }
.desk-title { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; padding-top: 1px; }
.desk-title b { font-size: 15px; font-weight: 600; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desk-title span { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.desk-status { display: inline-flex; align-items: center; gap: 6px; flex: none; margin-top: 2px; padding: 3px 10px 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 500; white-space: nowrap; background: var(--ok-soft); color: var(--ok); }
.desk-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.desk-status.busy { background: var(--warn-soft); color: var(--warn); }
.desk-status.mine { background: var(--brand-soft); color: var(--brand); }
.desk-busy-by { color: var(--text-2); margin-top: -4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk-notes { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.desk-card-foot { display: flex; align-items: center; gap: 6px; padding-top: 12px; margin-top: auto; border-top: 1px solid var(--line); }
.desk-access { flex: 1; min-width: 0; display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desk-access svg { width: 15px; height: 15px; flex: none; }
.desk-ellipsis { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk-warn { color: var(--warn); font-weight: 500; }
.desk-card .btn.ghost { background: none; border-color: transparent; color: var(--text-2); }
.desk-card .btn.ghost:hover { background: var(--nav-active); color: var(--text); }
.desk-card .icon-btn { font-size: 16px; line-height: 1; width: 30px; height: 30px; padding: 0; }
.desk-open { min-width: 64px; justify-content: center; }
.desk-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 40px 20px; text-align: center; }
.desk-empty b { font-size: 15px; margin-top: 6px; }
.desk-empty .btn { margin-top: 8px; }
.desk-hint { display: flex; gap: 10px; align-items: flex-start; max-width: 820px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface-2); color: var(--text-2); font-size: 13px; line-height: 1.55; }
.desk-hint-icon svg { width: 16px; height: 16px; color: var(--muted); margin-top: 2px; }
.desk-hint code { font-size: 12px; padding: 1px 6px; border-radius: 6px; background: var(--surface); border: 1px solid var(--line); white-space: nowrap; }
