/* RJRemoto — painel web (operador/admin). Paleta "dark tech" + verde de status,
   consistente com o Remoto.Console (ver src/Remoto.Console/Theme.cs). */

:root {
  --bg: #0f172a;
  --surface: #1b2336;
  --surface-2: #272f42;
  --border: #334155;
  --border-strong: #475569;
  --text: #f8fafc;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --accent: #22c55e;
  --accent-dim: #16a34a;
  --accent-soft: rgba(34, 197, 94, .14);
  --danger: #ef4444;
  --danger-soft: rgba(239, 68, 68, .14);
  --radius: 10px;
  --radius-lg: 14px;
  --font-sans: 'Fira Sans', system-ui, -apple-system, sans-serif;
  --font-mono: 'Fira Code', ui-monospace, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  margin: 0;
}

a { color: var(--accent); }
h1, h2, h3 { font-weight: 700; letter-spacing: -.01em; margin: 0 0 .4em; }
p { margin: 0 0 .6em; }
code, .mono { font-family: var(--font-mono); }

main, .page {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

/* ---- cards / panels ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}

/* ---- inputs ---- */
input[type=text], input[type=password], input[type=email], input[type=number], input:not([type]) {
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  padding: 10px 12px;
  min-height: 40px;
  width: 100%;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input::placeholder { color: var(--text-faint); }
input:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input[readonly] { color: var(--text-dim); cursor: text; }
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--text);
  -webkit-box-shadow: 0 0 0 1000px var(--bg) inset;
  box-shadow: 0 0 0 1000px var(--bg) inset;
  transition: background-color 9999s ease-in-out 0s;
}
input[type=number] { max-width: 90px; }

label, .field-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-dim);
  margin-bottom: 6px;
}

/* ---- buttons ---- */
button, .btn {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 16px;
  min-height: 40px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .1s ease;
}
button:hover { border-color: var(--accent-dim); }
button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
button:disabled { opacity: .5; cursor: not-allowed; }

button.primary, .btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #06130a;
}
button.primary:hover, .btn-primary:hover { background: var(--accent-dim); }

button.danger, .btn-danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
button.danger:hover { background: var(--danger-soft); }

/* ---- status badges / pills ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
}
.badge-ok { color: var(--accent); background: var(--accent-soft); }
.badge-blocked { color: var(--danger); background: var(--danger-soft); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ---- tables ---- */
.table-scroll { overflow-x: auto; border-radius: var(--radius-lg); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-faint);
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
tbody td { padding: 10px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }

/* ---- login ---- */
.login-card {
  max-width: 360px;
  margin: 72px auto 0;
}
.login-card h2 { font-size: 22px; }
.login-card .field { margin-bottom: 14px; }

/* ---- lists / device rows ---- */
.device-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.device-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px;
}
.device-row .name { font-weight: 600; }
.device-row .meta { color: var(--text-dim); font-size: 13px; }
.device-row .code { font-family: var(--font-mono); color: var(--accent); }
.device-row .actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }

/* ---- misc ---- */
.error-text { color: var(--danger); font-size: 13.5px; }
.muted { color: var(--text-dim); font-size: 13.5px; }
input.secret-box {
  font-family: var(--font-mono); background: var(--bg); border: 1px solid var(--accent-dim);
  color: var(--accent); border-radius: var(--radius); padding: 10px 12px; width: 100%;
}
.callout-ok {
  background: var(--accent-soft); border: 1px solid var(--accent-dim); border-radius: var(--radius);
  padding: 14px; margin-top: 12px;
}

@media (max-width: 560px) {
  .device-row .actions { margin-left: 0; width: 100%; }
}

/* ---- monitoring dashboard ---- */
.status-online { background: rgba(34, 197, 94, .05); }
.status-warning { background: rgba(245, 158, 11, .05); border-left: 2px solid #f59e0b; }
.status-critical { background: rgba(239, 68, 68, .05); border-left: 2px solid var(--danger); }

.badge-online { color: var(--accent); background: var(--accent-soft); }
.badge-warning { color: #f59e0b; background: rgba(245, 158, 11, .2); }
.badge-critical { color: var(--danger); background: var(--danger-soft); }

.progress-bar { background: var(--surface-2); height: 6px; border-radius: 3px; overflow: hidden; }
.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width .3s ease, background-color .3s ease;
}
.progress-bar-fill.warning { background: #f59e0b; }
.progress-bar-fill.critical { background: var(--danger); }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
  gap: 12px;
}
.metric { text-align: center; }
.metric-value { font-size: 1.5em; font-weight: 700; color: var(--accent); font-family: var(--font-mono); }
.metric-label { font-size: 11px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .04em; }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- layout v2: topbar + wide pages ---- */
.topbar {
  display: flex; align-items: center; gap: 28px;
  padding: 0 24px; height: 56px;
  background: var(--surface); border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.topnav { display: flex; gap: 4px; }
.topnav a {
  color: var(--text-dim); text-decoration: none; font-size: 14px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--radius); transition: background .15s ease, color .15s ease;
}
.topnav a:hover { background: var(--surface-2); color: var(--text); }
.topnav a.active { background: var(--accent-soft); color: var(--accent); }

.page.wide, .page { max-width: 1280px; }
.page h1 { font-size: 26px; }

.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.connect-card { max-width: 460px; margin-bottom: 28px; }
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.home-grid h3 { font-size: 15px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-dim); margin-bottom: 12px; }
@media (max-width: 960px) { .home-grid { grid-template-columns: 1fr; } }

.device-row { padding: 16px; border-radius: var(--radius-lg); transition: border-color .15s ease; }
.device-row:hover { border-color: var(--border-strong); }
.device-row .name { font-size: 16px; }
.device-row .code { font-size: 15px; background: var(--accent-soft); padding: 2px 10px; border-radius: 8px; }
.device-row .actions input { flex: 1; min-width: 160px; }

.page .card h3 { margin-bottom: 12px; }

/* ---- tela de controle: palco ocupa toda a área; ferramentas num painel lateral ---- */
.ctl { position: relative; display: flex; flex-direction: column; height: calc(100dvh - 56px); }
.ctl-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.ctl-back { text-decoration: none; font-weight: 600; font-size: 14px; }
.ctl-name { font-size: 15px; }
.ctl-info { font-size: 13px; font-family: var(--font-mono); }
.ctl-menu { margin-left: auto; display: flex; gap: 8px; }
.ctl-error { margin: 8px 16px 0; }
.ctl-stage { flex: 1; min-height: 0; overflow: auto; background: #000; }

.ctl-drawer {
  position: absolute; top: 0; right: 0; bottom: 0; width: min(400px, 100%);
  display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--border-strong);
  box-shadow: -12px 0 30px rgba(0,0,0,.45); z-index: 5;
}
.ctl-drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.ctl-drawer-head h3 { margin: 0; font-size: 16px; }
.ctl-drawer-body { padding: 16px; overflow: auto; }
.ctl-drawer-body h4 { margin: 0 0 8px; font-size: 14px; color: var(--text-dim); }
.ctl-check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; margin-bottom: 14px; }
.ctl-btns { display: grid; gap: 8px; margin-bottom: 12px; }
.ctl-files { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 14px; }
.ctl-files td { padding: 4px 6px; border-bottom: 1px solid var(--border); }

.dot-unread {
  display: inline-block; min-width: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 12px; line-height: 18px; text-align: center;
}
.ctl-chat { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.ctl-chat-log { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 85%; padding: 8px 12px; border-radius: var(--radius); background: var(--surface-2); }
.msg-mine { align-self: flex-end; background: var(--accent-soft); border: 1px solid var(--accent-dim); }
.msg-theirs { align-self: flex-start; }
.msg-meta { font-size: 11px; color: var(--text-faint); margin-bottom: 2px; }
.msg-text { white-space: pre-wrap; word-break: break-word; font-size: 14px; }
.ctl-chat-send { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--border); }
.ctl-chat-send input { flex: 1; min-width: 0; }

/* ---- painel "Área de transferência" ---- */
.ctl-switch {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; margin-bottom: 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); cursor: pointer;
}
.ctl-switch input { margin-top: 4px; accent-color: var(--accent); }
.ctl-switch small { display: block; color: var(--text-dim); font-size: 13px; margin-top: 2px; }
.ctl-note { padding: 10px 12px; border-radius: var(--radius); background: var(--accent-soft); font-size: 14px; }
.ctl-last { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.ctl-last-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 12px; background: var(--surface-2); font-size: 13px; }
.ctl-last-body { padding: 10px 12px; font-family: var(--font-mono); font-size: 13px; white-space: pre-wrap; word-break: break-word; max-height: 160px; overflow: auto; }

/* ---- dashboard: computador central + nós de usuários na rede ---- */
.dash-kpis { margin-bottom: 28px; }
.dash-section { margin-bottom: 30px; }
.dash-section h3 {
  font-size: 15px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-dim); margin-bottom: 16px;
}

.dash-central-wrap { display: flex; justify-content: center; }

/* conector vertical entre a central e a grade de dispositivos */
.dash-uplink {
  width: 2px; height: 30px; margin: 0 auto;
  background: linear-gradient(var(--accent-dim), transparent);
  position: relative;
}
.dash-uplink::after {
  content: ""; position: absolute; top: 8px; left: 50%; transform: translateX(-50%);
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 10px var(--accent);
}

.dash-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.dash-node {
  --node: var(--accent);
  position: relative;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px 14px 16px;
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}
.dash-node[role=button] { cursor: pointer; }
.dash-node[role=button]:hover,
.dash-node[role=button]:focus-visible {
  border-color: var(--node);
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, .35);
  outline: none;
}

.dash-node.central {
  width: min(300px, 100%);
  border-color: var(--accent-dim);
  background: linear-gradient(180deg, rgba(34, 197, 94, .12), var(--surface) 65%);
}
.dash-node.central.st-critical {
  border-color: var(--danger);
  background: linear-gradient(180deg, var(--danger-soft), var(--surface) 65%);
}

.dash-icon {
  width: 64px; height: 64px;
  display: grid; place-items: center;
  border-radius: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--node);
}
.dash-node.central .dash-icon { width: 72px; height: 72px; }

.dash-lamp {
  position: absolute; top: 12px; right: 14px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--node); box-shadow: 0 0 8px var(--node);
}

.dash-name { font-weight: 600; font-size: 15px; }
.dash-meta { font-size: 12px; color: var(--text-faint); }
.dash-tenant { font-size: 12px; color: var(--text-dim); }

.dash-code {
  font-size: 12.5px; color: var(--node);
  background: color-mix(in srgb, var(--node) 16%, transparent);
  padding: 2px 10px; border-radius: 999px;
}

.dash-user { font-size: 12.5px; color: var(--text-dim); }
.dash-user-tag {
  font-family: var(--font-mono); font-size: 10.5px; text-transform: uppercase;
  color: var(--accent); background: var(--accent-soft);
  padding: 1px 7px; border-radius: 999px; margin-left: 4px;
}

.dash-actions { display: flex; gap: 8px; margin-top: 6px; }
.dash-actions button { min-height: 34px; padding: 6px 16px; font-size: 13px; width: 100%; }

.dash-empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 34px; border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}

.st-online { --node: var(--accent); }
.st-warning { --node: #f59e0b; }
.st-critical { --node: var(--danger); }


/* controle no menu superior: espaçamento mais compacto que o do menu normal */
.topbar:has(.ctl-menu) { gap: 14px; }
.topbar .ctl-info { white-space: nowrap; }
