:root {
  --bg: #f4f6f9; --card: #ffffff; --ink: #1c2430; --muted: #5d6b7c; --line: #dde3ea;
  --brand: #0b5cad; --brand-ink: #ffffff; --ok: #1f8a4c; --warn: #b26a00; --bad: #c0392b;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
header { background: var(--brand); color: var(--brand-ink); padding: 14px 24px; display: flex; align-items: baseline; gap: 12px; }
header strong { font-size: 18px; }
header span { opacity: .85; font-size: 14px; }
main { max-width: 760px; margin: 32px auto; padding: 0 16px; }
main.wide { max-width: 1200px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 24px; margin-bottom: 16px; }
h1 { font-size: 22px; margin: 0 0 8px; }
h2 { font-size: 17px; margin: 0 0 12px; }
p { line-height: 1.5; }
.muted { color: var(--muted); font-size: 14px; }
label { display: block; font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
input[type=text], input[type=password] { width: 100%; padding: 10px 12px; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; }
input.code { font-size: 28px; letter-spacing: 4px; text-align: center; font-variant-numeric: tabular-nums; }
button { font: inherit; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink); cursor: pointer; }
button.secondary { background: transparent; color: var(--brand); }
button.danger { background: var(--bad); border-color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.error { color: var(--bad); min-height: 1.4em; margin-top: 8px; }
.status { font-weight: 600; }
.status.ok { color: var(--ok); } .status.warn { color: var(--warn); } .status.bad { color: var(--bad); }
.bigcode { font-size: 44px; font-weight: 700; letter-spacing: 6px; text-align: center; margin: 8px 0; font-variant-numeric: tabular-nums; }
ul.points { padding-left: 20px; line-height: 1.7; }
.grid { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
@media (max-width: 900px) { .grid { grid-template-columns: 1fr; } }
video { width: 100%; background: #0e1116; border-radius: 8px; min-height: 240px; display: block; }
dl.stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0; font-size: 14px; }
dl.stats dt { color: var(--muted); } dl.stats dd { margin: 0; font-variant-numeric: tabular-nums; }
.chatlog { height: 180px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 8px; font-size: 14px; background: #fafbfc; }
.chatlog .me { color: var(--brand); } .chatlog .them { color: var(--ink); } .chatlog .sys { color: var(--muted); font-style: italic; }
.chatrow { display: flex; gap: 8px; margin-top: 8px; } .chatrow input { flex: 1; }
.check { display: flex; gap: 8px; align-items: center; margin-top: 12px; font-size: 14px; color: var(--muted); }
.banner { background: #fff6e5; border: 1px solid #f0d49a; padding: 10px 14px; border-radius: 8px; font-size: 14px; }
footer { text-align: center; color: var(--muted); font-size: 12px; margin: 24px 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar button { padding: 6px 12px; font-size: 14px; }
.toolbar .spacer { flex: 1; }
.check.inline { margin: 0; }
.screen-wrap { background: #0e1116; border-radius: 8px; overflow: hidden; display: flex; justify-content: center; align-items: center; min-height: 240px; }
.screen-wrap:fullscreen { border-radius: 0; }
.screen-wrap.dragover { outline: 3px dashed #4da3ff; outline-offset: -4px; }
#screen { max-width: 100%; max-height: 80vh; display: block; cursor: default; outline: none; image-rendering: auto; }
.screen-wrap:fullscreen #screen { max-height: 100vh; }
#screen:focus { box-shadow: 0 0 0 2px var(--brand); }
#screen[hidden], #remote[hidden] { display: none; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 1000px) { .grid3 { grid-template-columns: 1fr; } }
ul.filelist { list-style: none; padding: 0; margin: 0; font-size: 14px; max-height: 220px; overflow-y: auto; }
ul.filelist li { padding: 6px 0; border-bottom: 1px solid var(--line); word-break: break-all; }
ul.filelist li:last-child { border-bottom: 0; }
a.button { display: inline-block; padding: 12px 22px; border-radius: 8px; background: var(--brand); color: var(--brand-ink); text-decoration: none; font-weight: 600; }
ol.points { padding-left: 20px; line-height: 1.7; }
.card.narrow { max-width: 440px; margin-left: auto; margin-right: auto; }
.userbar { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 14px; margin-bottom: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
input[type=email] { width: 100%; padding: 10px 12px; font-size: 16px; border: 1px solid var(--line); border-radius: 8px; }
/* Pantalla completa del visor (barra + imagen) */
#viewer:fullscreen { margin: 0; padding: 8px; border: 0; border-radius: 0; background: #0e1116; display: flex; flex-direction: column; }
#viewer:fullscreen .toolbar { margin-bottom: 8px; }
#viewer:fullscreen .toolbar button.secondary { background: #1c2430; color: #fff; border-color: #3a4656; }
#viewer:fullscreen .toolbar .check { color: #cfd6df; }
#viewer:fullscreen .screen-wrap { flex: 1; min-height: 0; border-radius: 0; }
#viewer:fullscreen #viewer-hint, #viewer:fullscreen .row { display: none; }
#viewer:fullscreen #screen { max-width: none; max-height: none; }
/* ---- consola ---- */
header .spacer { flex: 1; }
.hdr-user { font-size: 14px; }
.hdr-user a { color: #fff; }
.tabs { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 12px; }
.tabs button { background: transparent; color: var(--ink); border: 1px solid transparent; border-radius: 8px 8px 0 0; padding: 8px 16px; }
.tabs button.active { background: var(--card); border-color: var(--line); border-bottom-color: var(--card); font-weight: 600; color: var(--brand); }
.tabhead { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 12px; }
.tabhead h1 { margin: 0; }
.tabhead input[type=search] { min-width: 280px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
table.list { width: 100%; border-collapse: collapse; font-size: 14px; }
table.list th { text-align: left; color: var(--muted); font-weight: 500; padding: 8px; border-bottom: 1px solid var(--line); }
table.list td { padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.list tr.inactive td { opacity: .55; }
table.list td.actions { text-align: right; white-space: nowrap; }
table.list td.actions button { padding: 6px 12px; font-size: 13px; margin-left: 4px; }
.nowrap { white-space: nowrap; }
.small { font-size: 12px; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px #1f8a4c22; } .dot.off { background: #b8c0ca; }
button.danger-text { color: var(--bad); border-color: #e3b5b0; }
select { padding: 8px; border: 1px solid var(--line); border-radius: 8px; font: inherit; background: #fff; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form input { flex: 1; min-width: 160px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.qr { text-align: center; margin: 8px 0; }
.qr img { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #fff; }
.back-link { font-size: 14px; }
.dl { padding: 12px 0 20px; border-bottom: 1px solid var(--line); }
.dl:last-child { border-bottom: 0; }
.ok-msg { color: var(--ok); margin-top: 8px; }
.narrow-tab { max-width: 560px; }
code { background: #eef2f6; padding: 2px 6px; border-radius: 4px; font-size: 13px; }

/* v0.4: arrastrar archivos y progreso */
.transfers { position: fixed; left: 16px; bottom: 16px; z-index: 40; width: 360px; max-height: 60vh; overflow-y: auto; background: var(--card, #fff); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0, 0, 0, .18); padding: 12px 14px; font-size: 14px; }
.transfers-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.transfers-head .link { background: none; border: 0; font-size: 20px; line-height: 1; padding: 0 4px; color: inherit; cursor: pointer; }
.xfer { padding: 8px 0; border-top: 1px solid var(--line); }
.xfer:first-child { border-top: 0; }
.xfer-name { display: flex; justify-content: space-between; gap: 8px; word-break: break-all; }
.xfer-pct { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.xfer-bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 6px 0 4px; }
.xfer-bar > div { height: 100%; width: 0; background: var(--brand); transition: width .2s; }
.xfer.done .xfer-bar > div { background: #2e9d5b; }
.xfer.fail .xfer-bar > div { background: #c0392b; }
.xfer-sub { color: var(--muted, #667); font-size: 12px; }
.xfer-sub button { font-size: 12px; padding: 2px 8px; margin-left: 6px; }
.badge { background: #2e9d5b; color: #fff; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; }
.sup-table td .muted { font-size: 12px; }

/* v0.4.1: elegir sesión de Windows (Escritorio remoto) */
.ws-dialog { border: 1px solid var(--line); border-radius: 12px; padding: 22px 24px; width: min(560px, 92vw); box-shadow: 0 12px 40px rgba(0, 0, 0, .25); }
.ws-dialog::backdrop { background: rgba(14, 17, 22, .45); }
.ws-dialog h2 { margin: 0 0 6px; }
.ws-dialog select { width: 100%; font: inherit; padding: 6px; border: 1px solid var(--line); border-radius: 8px; }
.ws-dialog option { padding: 6px 8px; }
.ws-buttons { justify-content: flex-end; margin-top: 16px; }
.users-cell .muted { display: block; font-size: 12px; }
.ws-dialog input[type=password] { width: 100%; box-sizing: border-box; font: inherit; padding: 10px; border: 1px solid var(--line); border-radius: 8px; margin-top: 4px; }
.ip-cell { font-variant-numeric: tabular-nums; }
.ip-cell .muted { display: block; font-size: 12px; }
.lock { font-size: 12px; color: var(--muted); display: block; }
/* Datos del equipo en el visor */
.info-pop { position: absolute; z-index: 30; top: 100%; left: 0; margin-top: 6px; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.18); padding: 14px 18px; width: min(560px, 92vw); max-height: 75vh; overflow-y: auto; font-size: 14px; }
.info-pop dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.info-pop dt { color: var(--muted); }
.info-pop dd { margin: 0; font-variant-numeric: tabular-nums; user-select: all; }
.toolbar { position: relative; }
.dom { color: var(--muted); font-weight: 500; }
.info-head { display: flex; gap: 10px; align-items: baseline; }
.info-head .link { margin-left: auto; background: none; border: 0; font-size: 20px; line-height: 1; padding: 0 4px; color: inherit; cursor: pointer; }
.info-pop h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: 16px 0 8px; }
.info-pop .small { text-transform: none; letter-spacing: 0; font-weight: 400; }
.vol { margin-bottom: 10px; color: var(--ink); }
.vol-top { display: flex; justify-content: space-between; gap: 8px; }
.vol-bar { height: 10px; border-radius: 5px; background: var(--line); overflow: hidden; margin: 4px 0 2px; }
.vol-bar > div { height: 100%; background: var(--brand); }
.vol-bar.full > div { background: var(--bad); }
.vol-bar.warn > div { background: var(--warn); }
.hw { padding: 6px 0; border-top: 1px solid var(--line); color: var(--ink); }
.hw:first-child { border-top: 0; }
.hw .muted { font-size: 13px; }
.net-now { font-variant-numeric: tabular-nums; font-weight: 600; }
.tag { display: inline-block; border-radius: 999px; padding: 1px 8px; font-size: 12px; font-weight: 600; background: var(--line); margin-left: 6px; }
.tag.ded { background: #dbeafe; color: #1e3a8a; }
.tag.int { background: #e5e7eb; color: #374151; }
/* Nombre del equipo (DOMINIO\\EQUIPO): nunca se parte; al menos 28 caracteres de ancho */
#dev-table .name-cell { min-width: 28ch; white-space: nowrap; }
#dev-table td.name-cell strong { white-space: nowrap; }
#dev-table th, #dev-table td.actions { white-space: nowrap; }
.panel-main { max-width: 1480px; }
#tab-devices { overflow-x: auto; }
.nw { white-space: nowrap; }
.conn-dialog { width: min(980px, 94vw); }
.conn-dialog .info-head h2 { margin: 0; }
.conn-wrap { max-height: 60vh; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
#conn-table { margin: 0; }
#conn-table td, #conn-table th { white-space: nowrap; font-variant-numeric: tabular-nums; }
a.button { display: inline-block; text-decoration: none; font: inherit; padding: 10px 18px; border-radius: 8px; border: 1px solid var(--brand); }
a.button.secondary { color: var(--brand); background: transparent; }
