:root {
  --bg: #F3F6F3;
  --bg-2: #FFFFFF;
  --card: #FFFFFF;
  --border: #E3E8E3;
  --border-strong: #D6DED6;
  --input-bg: #F8FAF8;
  --text: #1F2937;
  --text-2: #374151;
  --muted: #6B7280;
  --faint: #9CA3AF;
  --accent: #2E9E44;
  --accent-hover: #25863A;
  --accent-soft: #E8F5EC;
  --accent-text: #1E8A3A;
  --info-soft: #E0F2FE;
  --info-text: #0E7490;
  --danger: #DC2626;
  --danger-soft: #FEE2E2;
  --ok: #1E8A3A;
  --warn: #B45309;
  --warn-soft: #FEF3C7;
  --table-head: #F7F9F7;
  --session-bg: #0B1220;
  --shadow-card: 0 4px 14px rgba(31, 58, 32, .06);
  --shadow-login: 0 10px 30px rgba(31, 58, 32, .08);
  --radius: 12px;
}
* { box-sizing: border-box; }
/* o atributo hidden precisa vencer qualquer display: definido abaixo (.view, .ghost...) */
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.4;
}
a { color: inherit; text-decoration: none; }
.view { display: flex; flex-direction: column; min-height: 100vh; }

/* ---- Login ---- */
#view-login { align-items: center; justify-content: center; padding: 24px 16px; }
.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-login);
  text-align: center;
}
.login-logo { display: block; width: 220px; max-width: 70%; height: auto; margin: 0 auto 18px; }
.login-card h1 { margin: 0 0 6px; font-size: 24px; font-weight: 700; color: var(--text); }
.login-card .sub { margin: 0 0 22px; color: var(--muted); font-size: 14px; }
.login-card label {
  display: block; margin-bottom: 16px; font-size: 13px; font-weight: 500;
  color: var(--text-2); text-align: left;
}
.login-card input {
  width: 100%; margin-top: 6px; padding: 12px 14px;
  background: var(--input-bg); border: 1px solid var(--border-strong);
  border-radius: 10px; color: var(--text); font-size: 14px; font-family: inherit;
}
.login-card input::placeholder { color: var(--faint); }
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46, 158, 68, .15); }
.login-card button {
  width: 100%; padding: 13px; margin-top: 4px;
  background: var(--accent); color: #fff; border: none;
  border-radius: 10px; font-size: 15px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.login-card button:hover { background: var(--accent-hover); }
.login-card button:disabled { opacity: .6; cursor: default; }
.login-card .login-footer { margin: 18px 0 0; font-size: 12px; color: var(--faint); }
.error { color: var(--danger); font-size: 13px; margin-top: 12px; }
.login-card label.remember {
  display: flex; align-items: center; gap: 8px; margin: -2px 0 14px;
  font-size: 13px; color: var(--muted); cursor: pointer; user-select: none;
}
.login-card label.remember input { width: auto; margin: 0; accent-color: var(--accent); }

/* ---- Topbar ---- */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 64px; padding: 0 28px; background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.topbar-logo { width: 96px; height: auto; display: block; }
.brand { display: flex; align-items: center; gap: 14px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.whoami { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; font-weight: 500; }
.ghost {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--border-strong);
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 500; font-family: inherit;
  display: inline-block; line-height: 1.2;
}
.ghost:hover { background: var(--bg); border-color: #C3CDC3; }
.ghost.danger { color: var(--danger); border-color: #FECACA; }
.ghost.danger:hover { background: var(--danger-soft); }
button.primary {
  background: var(--accent); color: #fff; border: 1px solid var(--accent);
  padding: 9px 16px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; font-family: inherit;
}
button.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
button:disabled { opacity: .6; cursor: default; }

/* ---- Apps grid ---- */
.apps-main { padding: 32px 36px; flex: 1; }
.apps-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.apps-heading { margin: 0; font-size: 20px; font-weight: 600; color: var(--text); }
/* pesquisa incremental (filtra os cartoes enquanto digita) */
.apps-search {
  width: min(340px, 100%); height: 38px; padding: 8px 12px 8px 36px;
  background: var(--bg-2) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px center / 16px;
  border: 1px solid var(--border-strong); border-radius: 10px; color: var(--text); font: inherit; font-size: 14px;
}
.apps-search::placeholder { color: var(--faint); }
.apps-search:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46, 158, 68, .15); }
.status { margin-bottom: 16px; color: var(--muted); font-size: 14px; }
/* agrupamento por VM (quando o usuario tem mais de uma VM liberada) */
.apps-groups { display: block; }
.vm-group { margin-bottom: 26px; }
.vm-group-title {
  margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .02em;
  color: var(--muted); display: flex; align-items: center; gap: 10px;
}
.vm-group-title::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.apps-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
}
.app-tile {
  background: var(--card); border: 1px solid var(--border); border-radius: 14px;
  padding: 22px 16px 20px; text-align: center; cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: transform .08s, border-color .08s, box-shadow .08s;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.app-tile:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 20px rgba(31, 58, 32, .10); }
.app-tile.disabled { opacity: .5; cursor: not-allowed; }
.app-tile.disabled:hover { transform: none; border-color: var(--border); box-shadow: var(--shadow-card); }
.app-icon {
  width: 56px; height: 56px; border-radius: 14px; flex: none;
  background: linear-gradient(180deg, #7DC242, #1E8A3A);
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; color: #fff;
}
.app-tile.desktop .app-icon { background: linear-gradient(180deg, #38BDF8, #0E7490); }
.app-icon.has-img { background: #fff; border: 1px solid var(--border); }
.app-icon.has-img img { width: 40px; height: 40px; object-fit: contain; display: block; }
.app-name { font-size: 14px; font-weight: 600; color: var(--text); }
.app-path { font-size: 12px; color: var(--muted); word-break: break-word; margin-top: -4px; }
.app-badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600;
  background: var(--accent-soft); color: var(--accent-text);
}
.app-badge.desktop { background: var(--info-soft); color: var(--info-text); }

/* ---- Session ---- */
/* barra da sessao: FIXA no topo (21/10: o auto-hide nao ficou bom). Fica no fluxo
   da coluna; a area remota (.session-container, flex: 1) comeca logo abaixo dela. */
.session-top {
  flex: none; position: relative; z-index: 5;
  gap: 12px; min-height: 36px; padding: 0 12px;
  background: var(--bg-2); border-bottom: 1px solid var(--border);
}
.session-top .brand { flex: 1; justify-content: center; font-size: 13px; }
.session-top .brand strong { font-weight: 600; }
.session-top .ghost { padding: 2px 10px; font-size: 12px; }
.session-actions { display: flex; align-items: center; gap: 6px; flex: none; }

/* transferencia de arquivos (area de trabalho), estilo AnyDesk: este computador a
   esquerda, a VM a direita. "dialog.modal" vem do index.html; display:flex so com
   [open], senao venceria o display:none do dialog fechado. */
dialog.modal.tx-modal { width: min(1280px, 97vw); height: min(780px, 92vh); max-width: none; max-height: none; padding: 14px 16px 16px; }
dialog.modal.tx-modal[open] { display: flex; flex-direction: column; gap: 10px; }
.tx-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
dialog.modal.tx-modal h3 { margin: 0; }
.tx-x { background: none; border: none; font-size: 22px; line-height: 1; color: var(--muted); cursor: pointer; padding: 2px 8px; border-radius: 6px; }
.tx-x:hover { background: var(--bg); color: var(--text); }
.tx-x:focus { outline: none; }
.tx-x:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.tx-panes { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.tx-pane {
  display: flex; flex-direction: column; min-height: 0; min-width: 0; overflow: hidden;
  border: 1px solid var(--border-strong); border-radius: 10px; background: var(--bg-2);
}
.tx-pane.over { outline: 2px dashed var(--accent); outline-offset: -3px; }
.tx-pane-head {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; background: var(--table-head); border-bottom: 1px solid var(--border);
}
.tx-pane.remote .tx-pane-head, .tx-pane.remote .tx-who, .tx-pane.remote .tx-acts { flex-direction: row-reverse; }
.tx-pane.remote .tx-names { text-align: right; }
.tx-who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tx-badge {
  width: 34px; height: 34px; flex: none; border-radius: 8px; font-size: 18px;
  display: flex; align-items: center; justify-content: center; background: var(--accent-soft);
}
.tx-pane.remote .tx-badge { background: var(--info-soft); }
.tx-names { display: flex; flex-direction: column; min-width: 0; }
.tx-names strong, .tx-names small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tx-names strong { font-size: 14px; color: var(--text); }
.tx-names small { font-size: 12px; color: var(--muted); }
.tx-acts { display: flex; align-items: center; gap: 6px; flex: none; }
.tx-acts .ghost { padding: 6px 10px; font-size: 12px; }
.tx-go {
  background: var(--accent); color: #fff; border: 1px solid var(--accent); border-radius: 8px;
  padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap;
}
.tx-go:hover:not(:disabled) { background: var(--accent-hover); }
.tx-go:disabled { opacity: .45; cursor: default; }
.tx-nav { display: flex; align-items: center; gap: 4px; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.tx-icon {
  width: 30px; height: 30px; flex: none; padding: 0; border: 1px solid transparent; border-radius: 6px;
  background: none; color: var(--text-2); font-size: 15px; cursor: pointer;
}
.tx-icon:hover:not(:disabled) { background: var(--bg); border-color: var(--border); }
.tx-icon:disabled { opacity: .3; cursor: default; }
dialog.modal input.tx-addr {
  flex: 1; min-width: 0; width: auto; height: 30px; margin: 0; padding: 4px 10px; border-radius: 6px;
  font: 13px/1 Consolas, "Courier New", monospace; background: var(--bg-2);
}
dialog.modal input.tx-addr[readonly] { background: var(--input-bg); color: var(--text-2); }
.tx-place {
  height: 30px; flex: none; padding: 0 6px; border: 1px solid var(--border-strong); border-radius: 6px;
  background: var(--bg-2); color: var(--text); font: inherit; font-size: 13px;
}
.tx-nav .tx-pick { flex: none; padding: 5px 10px; font-size: 12px; }
.tx-warn { padding: 6px 12px; font-size: 12px; line-height: 1.4; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid #FDE68A; }
.tx-warn.flash { background: var(--danger-soft); color: #991B1B; border-color: #FECACA; }
.tx-body { flex: 1; min-height: 0; display: flex; flex-direction: column; transition: opacity .15s; }
.tx-pane.busy .tx-body { opacity: .5; }
.tx-cols, .tx-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 150px; align-items: center; column-gap: 12px; }
.tx-cols { padding: 0 12px; background: #FBFCFB; border-bottom: 1px solid var(--border); }
.tx-col {
  padding: 7px 0; background: none; border: none; text-align: left; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--muted);
}
.tx-col:nth-child(2) { text-align: right; }
.tx-col.on { color: var(--text); }
.tx-col.on::after { content: ' ▲'; font-size: 9px; }
.tx-col.on[data-dir="desc"]::after { content: ' ▼'; }
.tx-list { flex: 1; min-height: 0; overflow: auto; list-style: none; margin: 0; padding: 2px 0; outline: none; }
.tx-row { padding: 4px 12px; font-size: 13px; cursor: default; user-select: none; }
.tx-row:hover { background: #F6F9F6; }
.tx-row.sel { background: var(--accent-soft); }
.tx-list:focus .tx-row.sel { background: #D3EEDB; }
.tx-row.hid .tx-nm { color: var(--muted); }
.tx-n { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tx-ico { flex: none; width: 18px; text-align: center; }
.tx-nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-s, .tx-d { color: var(--muted); font-size: 12px; white-space: nowrap; }
.tx-s { text-align: right; }
.tx-empty { padding: 32px 12px; text-align: center; color: var(--muted); font-size: 13px; }
.tx-msg {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 24px; text-align: center; color: var(--muted); font-size: 13px;
}
.tx-msg p { margin: 0; max-width: 440px; line-height: 1.5; }
.tx-msg-acts { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.tx-msg-acts .ghost { padding: 6px 12px; }
.tx-queue { flex: none; max-height: 132px; overflow: auto; list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.tx-queue:empty { display: none; }
.tx-q { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 3px 8px; align-items: center; font-size: 12.5px; }
.tx-q-arrow { text-align: center; font-weight: 700; color: var(--accent-text); }
.tx-q.down .tx-q-arrow { color: var(--info-text); }
.tx-q .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-q .p { color: var(--muted); white-space: nowrap; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
.tx-q .bar { grid-column: 2 / -1; height: 5px; border-radius: 3px; background: var(--border); overflow: hidden; }
.tx-q .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.tx-q.ok .p { color: var(--accent-text); }
.tx-q.err .p { color: var(--danger); }
.tx-q.err .bar i { background: var(--danger); }
@media (max-width: 900px) {
  .tx-panes { grid-template-columns: minmax(0, 1fr); grid-auto-rows: minmax(300px, 1fr); overflow: auto; }
  .tx-cols, .tx-row { grid-template-columns: minmax(0, 1fr) 80px; }
  .tx-col:nth-child(3), .tx-d { display: none; }
  .tx-acts .ghost { display: none; }
}
.session-status {
  padding: 8px 20px; background: var(--warn-soft); color: var(--warn); font-size: 13px;
  border-bottom: 1px solid #FDE68A;
}
.session-status a { color: inherit; text-decoration: underline; font-weight: 600; }
#view-session { height: 100vh; min-height: 0; }
.session-container { flex: 1; background: var(--session-bg); position: relative; overflow: hidden; min-height: 0; }
/* cada sessao aberta e um painel; so o ativo fica visivel */
.session-pane {
  position: absolute; inset: 0; overflow: hidden; outline: none;
  display: flex; align-items: flex-start; justify-content: center;
}
.session-pane .session-status { position: absolute; top: 0; left: 0; right: 0; z-index: 3; }

/* barra de tarefas (sessoes abertas) */
.taskbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: 42px; z-index: 20;
  display: flex; align-items: center; gap: 6px; padding: 0 8px;
  background: rgba(255,255,255,.97); border-top: 1px solid var(--border);
  box-shadow: 0 -2px 10px rgba(0,0,0,.06);
}
.taskbar-items { display: flex; align-items: center; gap: 6px; overflow-x: auto; flex: 1; min-width: 0; }
.taskbar .task {
  display: flex; align-items: center; gap: 8px; padding: 4px 8px 4px 8px; max-width: 260px;
  border-radius: 8px; border: 1px solid transparent; background: transparent; cursor: pointer;
  font: inherit; font-size: 13px; color: var(--text); white-space: nowrap;
}
.taskbar .task:hover { background: var(--bg); border-color: var(--border); }
.taskbar .task.active { background: var(--accent-soft, #E8F5EC); border-color: var(--accent); }
.taskbar .task img { width: 18px; height: 18px; object-fit: contain; }
.taskbar .task .ini {
  width: 18px; height: 18px; border-radius: 5px; color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #7DC242, #1E8A3A);
}
.taskbar .task.desktop .ini { background: linear-gradient(135deg, #38BDF8, #0E7490); }
.taskbar .task .lbl { overflow: hidden; text-overflow: ellipsis; }
.taskbar .task small { color: var(--muted); margin-left: 2px; }
.taskbar .task .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--warn, #F59E0B); flex: none; }
.taskbar .task .dot.on { background: #22C55E; }
.taskbar .task .dot.off { background: #EF4444; }
.taskbar .task .x { margin-left: 2px; padding: 0 5px; border-radius: 4px; color: var(--muted); font-size: 14px; line-height: 1; }
.taskbar .task .x:hover { background: #FEE2E2; color: #B91C1C; }
.taskbar-apps { flex: none; }
body.has-taskbar #view-session { height: calc(100vh - 42px); }
body.has-taskbar #view-apps { padding-bottom: 50px; }
/* As camadas do Guacamole sao canvases absolutos com z-index -1: sem um contexto
   de empilhamento proprio aqui, elas ficam ATRAS do fundo do container (tela escura). */
.session-container .guac-display { margin: 0; position: relative; z-index: 0; isolation: isolate; }
.session-container .guac-display canvas { display: block; }

/* =========================== ADMIN =========================== */
body.admin { display: flex; flex-direction: column; min-height: 100vh; }
.admin-nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.admin-nav a {
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 500; color: #4B5563;
}
.admin-nav a:hover { background: var(--bg); color: var(--text); }
.admin-nav a.active { background: var(--accent); color: #fff; }
.admin-main { padding: 28px 36px 32px; flex: 1; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; font-size: 18px; font-weight: 600; }
.toolbar h2 small { font-weight: 400; color: var(--muted); font-size: 13px; margin-left: 10px; }
.toolbar-actions { display: flex; gap: 10px; align-items: center; }
.toolbar-actions select, .toolbar-actions input, .fields select, .fields input, .fields textarea {
  background: var(--bg-2); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; font-family: inherit;
}
.toolbar-actions select { min-width: 190px; height: 36px; }
.toolbar-actions input[type=search] { min-width: 260px; height: 36px; }
.toolbar-actions input:focus, .toolbar-actions select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46, 158, 68, .15); }
.hint { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid #EEF2EE; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; background: var(--table-head); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover td { background: #FAFCFA; }
.table td.empty { color: var(--muted); text-align: center; padding: 28px; }
.table td.actions { white-space: nowrap; text-align: right; }
.table td.actions button { margin-left: 4px; padding: 5px 10px; font-size: 12px; }
.table td.icon-cell { white-space: nowrap; }
.table td.icon-cell img { width: 28px; height: 28px; object-fit: contain; vertical-align: middle; border-radius: 6px; border: 1px solid var(--border); background: #fff; padding: 2px; margin-right: 6px; }
.table td.icon-cell small { color: var(--muted); font-size: 11px; vertical-align: middle; }
.muted { color: var(--muted); }
.block { display: block; }
.warn { color: var(--warn); }
code.small, .table code { font-size: 11px; color: #4B5563; background: #F3F4F6; padding: 2px 6px; border-radius: 6px; overflow-wrap: break-word; }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.badge.on { background: var(--accent-soft); color: var(--accent-text); }
.badge.off { background: var(--danger-soft); color: #B91C1C; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow-card); }
.panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.panel .table-wrap { border: none; }
.kv { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid #EEF2EE; font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); min-width: 180px; }
.kv .v { color: var(--text); }

/* acessos: um cartao por usuario */
.user-cards { display: grid; gap: 14px; }
.user-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); overflow: hidden; }
.user-card.off { opacity: .7; }
.user-card-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; background: var(--table-head); border-bottom: 1px solid var(--border);
}
.user-card-head .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.user-card-head .avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--accent-soft); color: var(--accent-text); font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center;
}
.user-card-head .name { font-size: 14px; }
.user-card-head .count { color: var(--muted); font-size: 12px; margin-top: 1px; }
.user-card-head .card-actions { display: flex; gap: 8px; }
.user-card-head .card-actions button { padding: 6px 12px; font-size: 12px; }
.user-card-head .name strong { font-size: 15px; }
.user-card-head .name .login { font-size: 12px; margin-left: 8px; }

/* resumo dos acessos: uma linha por VM, chips com o que abre */
.access-summary { padding: 10px 16px 12px; display: grid; gap: 6px; }
.access-summary .vm-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.access-summary .vm-name { font-weight: 600; min-width: 170px; display: inline-flex; align-items: baseline; gap: 8px; }
.access-summary .vm-name small { font-weight: 400; font-size: 11px; }
.access-summary .chips { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px;
  background: var(--accent-soft); color: var(--accent-text); border: 1px solid #BBE5C6; font-weight: 500;
}
.chip.desktop { background: var(--info-soft); color: var(--info-text); border-color: #BAE6FD; }
.chip.off { opacity: .55; text-decoration: line-through; }

.user-card .table-wrap { border: none; border-radius: 0; box-shadow: none; }
.user-card .table.compact th, .user-card .table.compact td { padding: 8px 14px; }
.user-card .table.compact th { background: #FBFCFB; }
.user-card .empty-state { padding: 14px 16px; color: var(--muted); font-size: 13px; }
.panel.empty-state { color: var(--muted); font-size: 13px; text-align: center; padding: 28px; }

/* switch (ativo/inativo) */
.switch { display: inline-flex; align-items: center; cursor: pointer; }
.switch input {
  appearance: none; -webkit-appearance: none; width: 36px; height: 20px; margin: 0; border-radius: 999px;
  background: #CBD5D1; position: relative; cursor: pointer; transition: background .15s; outline: none;
}
.switch input::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%;
  background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: left .15s;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { left: 18px; }
.switch input:disabled { opacity: .5; cursor: wait; }
.switch input:focus-visible { box-shadow: 0 0 0 3px rgba(46, 158, 68, .25); }

/* modal: checklist e valor fixo */
.field.static .value {
  padding: 8px 12px; background: var(--table-head); border: 1px dashed var(--border-strong);
  border-radius: 8px; font-weight: 600; color: var(--text);
}
.checklist {
  display: flex; flex-direction: column; gap: 4px; max-height: 190px; overflow: auto;
  border: 1px solid var(--border-strong); border-radius: 8px; padding: 8px 10px; background: var(--input-bg);
}
.checklist label { display: flex; align-items: center; gap: 8px; font-weight: 400; font-size: 13px; color: var(--text); padding: 3px 2px; border-radius: 6px; cursor: pointer; }
.checklist label:hover { background: rgba(46, 158, 68, .06); }
.checklist label.all { font-weight: 600; border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 2px; border-radius: 0; }
/* especificidade maior que ".field input { width:100%; padding... }" */
.fields .field .checklist input[type=checkbox] {
  width: 15px; height: 15px; margin: 0; padding: 0; border: none; background: none; border-radius: 3px;
  accent-color: var(--accent); flex: none; box-shadow: none;
}
.checklist label span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.checklist label small { color: var(--muted); font-size: 11px; margin-left: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 55%; }

/* senha com Gerar / Mostrar / Copiar */
.pw-gen { display: flex; gap: 6px; align-items: center; }
.pw-gen input { flex: 1; min-width: 0; }
.pw-gen input[type=text] { font-family: Consolas, "Courier New", monospace; font-weight: 600; letter-spacing: .5px; color: var(--accent-text); }
.pw-gen .mini { padding: 7px 10px; font-size: 12px; white-space: nowrap; flex: none; }
.pw-gen .mini.gen { border-color: #BBE5C6; color: var(--accent-text); }
.pw-gen .mini.gen:hover { background: var(--accent-soft); }
.pw-gen .mini.on { background: var(--accent-soft); border-color: #BBE5C6; color: var(--accent-text); }
.field.dim { opacity: .55; }

/* usuarios: e-mail e credenciais */
.table td.email-cell a { color: var(--text); text-decoration: none; }
.table td.email-cell a:hover { text-decoration: underline; color: var(--accent-text); }
.table td.cred-cell .sent { color: var(--accent-text); font-weight: 600; font-size: 12px; }
.table td.cred-cell .sent small { display: block; font-weight: 400; }
.table td.actions button.dim { opacity: .45; }
.table td.actions button.dim:hover { opacity: .7; }

/* gateway: painel SMTP */
.panel-head .badge { margin-left: auto; }
.mail-test { display: flex; gap: 8px; align-items: center; margin-top: 12px; flex-wrap: wrap; }
.mail-test input {
  flex: 1; min-width: 220px; max-width: 380px; height: 36px;
  background: var(--bg-2); border: 1px solid var(--border-strong); color: var(--text);
  border-radius: 8px; padding: 8px 12px; font-size: 13px; font-family: inherit;
}
.mail-test input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46, 158, 68, .15); }
.mail-test input:disabled, .mail-test button:disabled { opacity: .55; cursor: not-allowed; }

/* modal */
dialog#confirm-modal {
  background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 22px; width: min(440px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
dialog#confirm-modal::backdrop { background: rgba(31,41,55,.45); }
dialog#confirm-modal h3 { margin: 0 0 10px; font-size: 16px; font-weight: 600; }
dialog#confirm-modal .confirm-msg { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text); white-space: pre-wrap; }
/* comando completo (historico da aba Comandos) */
dialog#cmd-modal {
  background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 12px;
  padding: 20px 22px; width: min(820px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
dialog#cmd-modal::backdrop { background: rgba(31,41,55,.45); }
dialog#cmd-modal h3 { margin: 0 0 4px; font-size: 16px; font-weight: 600; }
dialog#cmd-modal .cmd-modal-vms { margin: 0 0 10px; font-size: 13px; }
dialog#cmd-modal .exec-output { max-height: 60vh; margin: 0; }
#tbl-exec-history td.cmd-cell { cursor: pointer; }
#tbl-exec-history td.cmd-cell:hover code { text-decoration: underline; }
#tbl-exec-history td.vms-cell { font-size: 13px; max-width: 320px; }
button.primary.danger { background: #DC2626; border-color: #DC2626; }
button.primary.danger:hover { background: #B91C1C; }
dialog#modal {
  background: var(--card); color: var(--text); border: 1px solid var(--border);
  border-radius: 14px; padding: 24px; width: min(640px, 94vw); box-shadow: 0 20px 60px rgba(31, 58, 32, .18);
}
dialog#modal::backdrop { background: rgba(31, 41, 55, .45); }
dialog#modal h3 { margin: 0 0 16px; font-size: 17px; font-weight: 600; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.field.wide { grid-column: 1 / -1; }
.field.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 13px; margin-top: 6px; }
.field.check input { width: 16px; height: 16px; accent-color: var(--accent); }
.field small { color: var(--muted); font-size: 11px; font-weight: 400; }
.field input, .field select, .field textarea { width: 100%; background: var(--input-bg); }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(46, 158, 68, .15); }
.field input[type=file] { padding: 6px 8px; background: var(--bg-2); cursor: pointer; }
.field input[type=file]::file-selector-button {
  background: var(--bg-2); color: var(--text); border: 1px solid var(--border-strong);
  padding: 5px 10px; border-radius: 6px; margin-right: 10px; font-family: inherit; font-size: 12px; cursor: pointer;
}
.field input[type=file]::file-selector-button:hover { background: var(--bg); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }

/* toast */
.toast {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  background: var(--accent-soft); color: #14532D; border: 1px solid #BBE5C6;
  padding: 10px 14px; border-radius: 10px; font-size: 13px; max-width: 420px;
  box-shadow: 0 10px 30px rgba(31, 58, 32, .15);
}
.toast.err { background: var(--danger-soft); color: #991B1B; border-color: #FECACA; }

/* ---------- comandos (WinRM em massa) ---------- */
.exec-layout { display: grid; grid-template-columns: minmax(360px, 1fr) minmax(0, 1.4fr); gap: 16px; align-items: start; }
/* campos da aba em uma coluna: o comando ocupa a largura toda do painel */
#tab-comandos .fields { grid-template-columns: 1fr; gap: 6px; }
#exec-command {
  width: 100%; box-sizing: border-box; min-height: 240px; resize: vertical;
  font: 13px/1.45 Consolas, "Courier New", monospace;
}
.exec-all { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; margin: 14px 0 6px; cursor: pointer; }
.exec-all input { width: 16px; height: 16px; accent-color: var(--accent); }
.exec-vms { max-height: 420px; overflow-y: auto; }
.exec-results { display: flex; flex-direction: column; gap: 10px; }
.exec-card { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; background: var(--input-bg); }
.exec-card.ok { border-color: #BBE5C6; background: var(--accent-soft); }
.exec-card.err { border-color: #FECACA; background: var(--danger-soft); }
.exec-card-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; }
.exec-output {
  margin: 8px 0 0; padding: 8px 10px; background: var(--session-bg, #0B1220); color: #D1E7D1;
  border-radius: 8px; font-size: 12px; font-family: Consolas, "Courier New", monospace;
  white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow: auto;
}
.exec-card .hint { margin: 6px 0 0; }

@media (max-width: 720px) {
  .fields { grid-template-columns: 1fr; }
  .exec-layout { grid-template-columns: 1fr; }
  .admin-main { padding: 16px; }
  .apps-main { padding: 20px 16px; }
  .topbar { flex-wrap: wrap; padding: 10px 16px; gap: 10px; }
  .admin-nav { order: 3; flex-basis: 100%; justify-content: flex-start; overflow-x: auto; }
  .login-card { padding: 28px 22px; }
}
