/* OxGuard console — dark, information-dense security-operator theme.
   One stylesheet, no framework. Custom properties drive the palette so a later
   locked-down build can re-skin without touching markup. */

:root {
  --bg:          #0b0f14;
  --bg-raised:   #111823;
  --bg-panel:    #141d2a;
  --bg-input:    #0d141d;
  --border:      #22303f;
  --border-soft: #1a2430;
  --text:        #e6edf3;
  --text-dim:    #8b9bb0;
  --text-faint:  #5c6b7e;
  --accent:      #3da5ff;
  --accent-dim:  #1d6fbf;
  --ok:          #35c46a;
  --warn:        #f5b23d;
  --danger:      #ff4d4d;
  --danger-dim:  #b31e1e;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --radius: 8px;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

#app { min-height: 100%; display: flex; flex-direction: column; }

/* ---- top bar ---------------------------------------------------------- */
#topbar {
  display: flex; align-items: center; gap: 24px;
  padding: 0 20px; height: 56px;
  background: var(--bg-raised);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: baseline; gap: 8px; }
.brand-mark { font-size: 18px; }
.brand-name { font-weight: 700; letter-spacing: .3px; }
.brand-sub { color: var(--text-faint); font-size: 12px; }
#mainnav { display: flex; gap: 6px; }
#mainnav a {
  padding: 6px 12px; border-radius: 6px; color: var(--text-dim);
  font-weight: 500; text-decoration: none;
}
#mainnav a:hover { background: var(--bg-panel); color: var(--text); }
#mainnav a.active { background: var(--bg-panel); color: var(--text); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 16px; }
.operator {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; background: var(--bg-panel);
  border: 1px solid var(--border); border-radius: 999px;
}
.op-avatar { font-size: 14px; }
.op-name { font-weight: 600; }
.wss-state { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-dim); }
.wss-state .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.wss-state.online .dot { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.wss-state.connecting .dot { background: var(--warn); }
.wss-state.offline .dot { background: var(--danger); }

/* ---- view container --------------------------------------------------- */
#view { flex: 1; padding: 24px; max-width: 1440px; width: 100%; margin: 0 auto; }
.view-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.view-head h1 { font-size: 20px; margin: 0; }
.view-head .sub { color: var(--text-dim); font-size: 13px; }
.spacer { flex: 1; }

/* ---- buttons / inputs ------------------------------------------------- */
.btn {
  font: inherit; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border); background: var(--bg-panel); color: var(--text);
  padding: 8px 16px; border-radius: 6px; transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg-raised); border-color: var(--accent-dim); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent-dim); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-dim); }
.btn-ghost:hover { background: var(--bg-panel); color: var(--text); }
.btn-danger { background: var(--danger-dim); border-color: var(--danger); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
input, select, textarea {
  font: inherit; background: var(--bg-input); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
label { color: var(--text-dim); font-size: 12px; display: block; margin-bottom: 4px; }

/* ---- panels / cards --------------------------------------------------- */
.panel {
  background: var(--bg-panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 16px;
}
.panel h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-dim); margin: 0 0 12px; font-weight: 700; }
.grid { display: grid; gap: 16px; }
.cols-2 { grid-template-columns: repeat(2, 1fr); }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1000px) { .cols-3, .cols-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .cols-2, .cols-3, .cols-4 { grid-template-columns: 1fr; } }

/* ---- badges / status -------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--border);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; }
.badge.online { color: var(--ok); border-color: rgba(53,196,106,.4); }
.badge.online .dot { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.badge.offline { color: var(--text-faint); }
.badge.offline .dot { background: var(--text-faint); }
.badge.revoked { color: var(--danger); border-color: rgba(255,77,77,.4); }
.badge.revoked .dot { background: var(--danger); }
.badge.warn { color: var(--warn); border-color: rgba(245,178,61,.4); }

/* The headline security badge: an unexpected remote-access tool on a host. */
.badge-rat {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px; border-radius: 6px; font-size: 12px; font-weight: 700;
  color: #fff; background: var(--danger-dim); border: 1px solid var(--danger);
  animation: ratpulse 2s ease-in-out infinite;
}
@keyframes ratpulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(255,77,77,.5); }
  50%     { box-shadow: 0 0 0 6px rgba(255,77,77,0); }
}

/* ---- fleet grid ------------------------------------------------------- */
.fleet-toolbar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.fleet-toolbar input[type=search] { min-width: 240px; }
.stat-row { display: flex; gap: 12px; margin-bottom: 20px; flex-wrap: wrap; }
.stat {
  background: var(--bg-panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 12px 18px; min-width: 120px;
}
.stat .n { font-size: 24px; font-weight: 700; }
.stat .l { font-size: 12px; color: var(--text-dim); }
.stat.alert .n { color: var(--danger); }

.host-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.host-card {
  background: var(--bg-panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 14px; cursor: pointer;
  transition: border-color .12s, transform .12s; text-decoration: none; color: inherit;
  display: flex; flex-direction: column; gap: 10px;
}
.host-card:hover { border-color: var(--accent-dim); transform: translateY(-1px); text-decoration: none; }
.host-card.flagged { border-color: rgba(255,77,77,.5); }
.host-card .hc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.host-card .hc-name { font-weight: 700; font-size: 15px; }
.host-card .hc-meta { display: grid; grid-template-columns: auto 1fr; gap: 4px 10px; font-size: 12px; }
.host-card .hc-meta .k { color: var(--text-faint); }
.host-card .hc-meta .v { color: var(--text-dim); font-family: var(--mono); }

/* ---- tables ----------------------------------------------------------- */
table.data { width: 100%; border-collapse: collapse; font-size: 13px; }
table.data th {
  text-align: left; color: var(--text-dim); font-weight: 600; font-size: 11px;
  text-transform: uppercase; letter-spacing: .5px; padding: 8px 10px;
  border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-panel);
}
table.data td { padding: 7px 10px; border-bottom: 1px solid var(--border-soft); }
table.data tr:hover td { background: var(--bg-raised); }
table.data td.mono, table.data th.mono { font-family: var(--mono); }
.table-scroll { overflow: auto; max-height: 420px; border: 1px solid var(--border-soft); border-radius: var(--radius); }

/* ---- host page -------------------------------------------------------- */
.host-header { display: flex; align-items: center; gap: 16px; margin-bottom: 8px; flex-wrap: wrap; }
.host-header h1 { margin: 0; font-size: 22px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13px; }
.kv .k { color: var(--text-faint); }
.kv .v { font-family: var(--mono); word-break: break-word; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin: 18px 0; flex-wrap: wrap; }
.tabs button {
  background: transparent; border: none; color: var(--text-dim); font: inherit; font-weight: 600;
  padding: 10px 14px; cursor: pointer; border-bottom: 2px solid transparent;
}
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* live telemetry sparkbars */
.meter { display: flex; flex-direction: column; gap: 6px; }
.meter .mlabel { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-dim); }
.meter .track { height: 8px; background: var(--bg-input); border-radius: 4px; overflow: hidden; }
.meter .fill { height: 100%; background: var(--accent); transition: width .4s; }
.meter .fill.hot { background: var(--warn); }
.meter .fill.crit { background: var(--danger); }

/* process timeline scrubber */
.scrub { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
.scrub input[type=range] { flex: 1; }
.scrub .stamp { font-family: var(--mono); font-size: 12px; color: var(--text-dim); min-width: 160px; text-align: right; }

/* ---- powershell console ---------------------------------------------- */
.ps-console { display: flex; flex-direction: column; gap: 10px; }
.ps-out {
  background: #05090d; border: 1px solid var(--border); border-radius: var(--radius);
  font-family: var(--mono); font-size: 12.5px; padding: 12px; min-height: 200px;
  max-height: 380px; overflow: auto; white-space: pre-wrap; word-break: break-word;
}
.ps-out .op { color: var(--accent); }
.ps-out .err { color: var(--danger); }
.ps-out .meta { color: var(--text-faint); }
.ps-input { display: flex; gap: 10px; }
.ps-input textarea { flex: 1; font-family: var(--mono); min-height: 60px; resize: vertical; }

/* ---- transparency notices (loud) ------------------------------------- */
.notice-consent {
  display: flex; align-items: flex-start; gap: 10px;
  background: rgba(245,178,61,.08); border: 1px solid rgba(245,178,61,.4);
  border-radius: var(--radius); padding: 12px 14px; color: var(--warn); font-size: 13px;
}
.notice-consent strong { color: #ffd98a; }
.notice-consent .ico { font-size: 16px; line-height: 1.3; }

/* ---- live screen viewer ---------------------------------------------- */
.screen-wrap { display: grid; grid-template-columns: 1fr 280px; gap: 16px; align-items: start; }
@media (max-width: 900px) { .screen-wrap { grid-template-columns: 1fr; } }
.screen-stage {
  position: relative; background: #000; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9;
  display: flex; align-items: center; justify-content: center;
}
.screen-stage canvas { max-width: 100%; max-height: 100%; display: block; image-rendering: auto; }
.screen-stage .placeholder { color: var(--text-faint); text-align: center; padding: 40px; }
.screen-banner-preview {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5;
  background: var(--danger); color: #fff; font-weight: 700; text-align: center;
  padding: 6px; font-size: 13px; letter-spacing: .3px;
}
.session-stats { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 12px; }
.session-stats .k { color: var(--text-faint); }
.session-stats .v { font-family: var(--mono); }
.control-toggle { display: flex; gap: 8px; }
.control-toggle .btn { flex: 1; }

/* ---- security pane ---------------------------------------------------- */
.sev { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.sev.high { background: var(--danger); }
.sev.med { background: var(--warn); }
.sev.low { background: var(--text-faint); }
.sec-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 900px) { .sec-cols { grid-template-columns: 1fr; } }

/* ---- login gate ------------------------------------------------------- */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 50% -10%, #13233a 0%, var(--bg) 60%);
}
.login-card {
  width: 100%; max-width: 420px; background: var(--bg-raised);
  border: 1px solid var(--border); border-radius: 12px; padding: 32px; box-shadow: var(--shadow);
}
.login-card .logo { font-size: 34px; text-align: center; }
.login-card h1 { text-align: center; margin: 8px 0 4px; font-size: 22px; }
.login-card .tag { text-align: center; color: var(--text-dim); margin-bottom: 24px; font-size: 13px; }
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); padding: 28px 16px;
  text-align: center; color: var(--text-dim); cursor: pointer; transition: border-color .12s, background .12s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: rgba(61,165,255,.05); }
.dropzone .big { font-size: 24px; margin-bottom: 8px; }
.dropzone .keyname { color: var(--accent); font-family: var(--mono); margin-top: 8px; word-break: break-all; }
.login-err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }
.login-note { margin-top: 18px; font-size: 12px; color: var(--text-faint); text-align: center; }

/* ---- toasts ----------------------------------------------------------- */
#toast-host { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  background: var(--bg-raised); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 6px; padding: 12px 16px; box-shadow: var(--shadow); max-width: 360px; font-size: 13px;
  animation: toastin .18s ease;
}
.toast.err { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } }

/* ---- misc ------------------------------------------------------------- */
.mono { font-family: var(--mono); }
.dim { color: var(--text-dim); }
.faint { color: var(--text-faint); }
.empty { color: var(--text-faint); text-align: center; padding: 40px; font-size: 13px; }
.loading { color: var(--text-dim); padding: 24px; text-align: center; }
.pill { font-family: var(--mono); font-size: 11px; background: var(--bg-input); border: 1px solid var(--border-soft);
  border-radius: 4px; padding: 1px 6px; color: var(--text-dim); }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
hr.sep { border: none; border-top: 1px solid var(--border-soft); margin: 16px 0; }
