:root {
  --bg: #0e1116;
  --panel: #171c24;
  --panel-2: #1f2530;
  --line: #2a313d;
  --text: #e6e9ef;
  --muted: #8b94a3;
  --accent: #3b82f6;
  --suporte: #3b82f6;
  --infra: #16a34a;
  --green: #22c55e;
  --red: #ef4444;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ---------- Login ---------- */
.login-body { display: grid; place-items: center; }
.login-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 36px 32px;
  width: 340px;
  box-shadow: 0 18px 60px rgba(0,0,0,.45);
}
.login-card h1 { margin: 0; font-size: 30px; letter-spacing: .5px; }
.login-card h1 span { color: var(--accent); }
.login-card .sub { margin: 4px 0 22px; color: var(--muted); }
.login-card label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.login-card input {
  width: 100%; margin-top: 6px; padding: 11px 12px;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 8px; color: var(--text); font-size: 14px;
}
.login-card button {
  width: 100%; margin-top: 8px; padding: 12px;
  background: var(--accent); color: #fff; border: 0;
  border-radius: 8px; font-size: 15px; font-weight: 600; cursor: pointer;
}
.alert { background: rgba(239,68,68,.15); border: 1px solid var(--red);
  color: #fecaca; padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.login-dl { display: block; text-align: center; margin-top: 16px; color: var(--muted);
  font-size: 13px; text-decoration: none; }
.login-dl:hover { color: var(--accent); }

/* ---------- Download ---------- */
.download-card { background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 36px 32px; width: 420px;
  box-shadow: 0 18px 60px rgba(0,0,0,.45); }
.download-card h1 { margin: 0; font-size: 30px; }
.download-card h1 span { color: var(--accent); }
.download-card .sub { margin: 4px 0 22px; color: var(--muted); }
.dl-list { display: flex; flex-direction: column; gap: 12px; }
.dl-item { display: flex; align-items: center; gap: 12px; padding: 14px 16px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; }
.dl-meta { flex: 1; }
.dl-name { font-weight: 600; }
.dl-sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.dl-hint { color: var(--muted); font-size: 13px; margin-top: 20px; line-height: 1.5; }
.dl-back { display: inline-block; margin-top: 8px; color: var(--accent);
  text-decoration: none; font-size: 13px; }

/* ---------- App shell ---------- */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand { font-weight: 700; font-size: 20px; }
.brand span { color: var(--accent); }
.spacer { flex: 1; }
.who { color: var(--muted); font-size: 14px; }
.logout { color: var(--muted); text-decoration: none; font-size: 14px;
  border: 1px solid var(--line); padding: 6px 12px; border-radius: 7px; }
.logout:hover { color: var(--text); border-color: var(--accent); }
.role-badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; }
.role-suporte { background: rgba(59,130,246,.16); color: #93c5fd; }
.role-infra { background: rgba(22,163,74,.16); color: #86efac; }

.app-flash { margin: 16px 20px 0; }

/* ---------- Dashboard ---------- */
.dashboard { padding: 24px 20px; }
.dash-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.dash-head h2 { margin: 0; font-size: 18px; }
.counter { color: var(--muted); font-size: 13px; }
table.agents { width: 100%; border-collapse: collapse; font-size: 14px; }
table.agents th {
  text-align: left; color: var(--muted); font-weight: 500; font-size: 12px;
  text-transform: uppercase; letter-spacing: .4px; padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}
table.agents td { padding: 12px; border-bottom: 1px solid var(--line); }
table.agents tr.empty td { color: var(--muted); text-align: center; padding: 40px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }
.dot.online { background: var(--green); box-shadow: 0 0 0 3px rgba(34,197,94,.18); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; }
.badge-busy { font-size: 11px; color: #fbbf24; border: 1px solid #92702a;
  padding: 2px 7px; border-radius: 999px; margin-left: 6px; }
.btn-connect {
  background: var(--accent); color: #fff; border: 0; padding: 7px 16px;
  border-radius: 7px; cursor: pointer; font-size: 13px; font-weight: 600; text-decoration: none;
}
.btn-connect:hover { filter: brightness(1.08); }
.btn-connect.disabled { background: var(--panel-2); color: var(--muted); pointer-events: none; }

/* ---------- Remote ---------- */
.remote-body { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.remote-topbar .conn-info { display: flex; flex-direction: column; line-height: 1.15; }
.conn-host { font-weight: 600; }
.conn-id { color: var(--muted); font-size: 12px; font-family: ui-monospace, monospace; }
.status-pill { font-size: 12px; padding: 5px 12px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); }
.status-pill.ok { color: #86efac; border-color: #2f6b43; }
.status-pill.err { color: #fecaca; border-color: #7f3030; }
.toggle { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.stage { flex: 1; display: grid; place-items: center; background: #05070a; overflow: hidden; }
#screen { max-width: 100%; max-height: 100%; cursor: none; outline: none;
  image-rendering: auto; background: #000; }
.overlay { position: fixed; inset: 0; background: rgba(5,7,10,.82);
  display: grid; place-items: center; z-index: 50; }
.overlay.hidden { display: none; }
.hidden { display: none !important; }

/* layout principal: tela + painel lateral */
.remote-main { flex: 1; display: flex; min-height: 0; }
.tool-btn { background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 7px; padding: 6px 12px; font-size: 13px; cursor: pointer; }
.tool-btn:hover { border-color: var(--accent); }
.tool-btn.small { padding: 2px 9px; font-size: 16px; line-height: 1; }
.monitor-select { background: var(--panel-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 7px; padding: 6px 8px; font-size: 13px; }

/* painel de arquivos */
.files-panel { width: 320px; background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; }
.files-head { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--line); }
.files-section { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.files-section.files-grow { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.files-label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--muted); margin-bottom: 8px; }
.upload-drop { display: block; border: 1.5px dashed var(--line); border-radius: 9px;
  padding: 18px; text-align: center; color: var(--muted); font-size: 13px; cursor: pointer; }
.upload-drop.over { border-color: var(--accent); color: var(--text); background: rgba(59,130,246,.08); }
.remote-path { font-size: 11px; color: var(--muted); margin-bottom: 8px; word-break: break-all; }
.remote-list { flex: 1; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.rl-row { display: flex; justify-content: space-between; gap: 8px; padding: 7px 10px;
  font-size: 13px; cursor: pointer; border-bottom: 1px solid var(--line); }
.rl-row:last-child { border-bottom: 0; }
.rl-row:hover { background: var(--panel-2); }
.rl-row.file { cursor: default; }
.rl-row.file:hover { background: rgba(59,130,246,.08); cursor: pointer; }
.rl-size { color: var(--muted); font-size: 11px; white-space: nowrap; }
.rl-empty, .rl-err { padding: 10px; color: var(--muted); font-size: 12px; }
.rl-err { color: #fecaca; }
.transfers { display: flex; flex-direction: column; gap: 8px; max-height: 160px; overflow: auto; }
.tr-item { font-size: 12px; }
.tr-name { color: var(--text); margin-bottom: 4px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; }
.tr-bar { height: 6px; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.tr-bar span { display: block; height: 100%; width: 0; background: var(--accent);
  transition: width .15s; }
.tr-pct { color: var(--muted); font-size: 11px; margin-top: 3px; }
.overlay-card { text-align: center; color: var(--text); }
.spinner { width: 42px; height: 42px; margin: 0 auto 16px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
