:root {
  --bg: #0e1014; --bg2: #14171e; --panel: #171b23; --panel2: #1d222c;
  --border: #272d39; --border2: #333b49;
  --text: #e6e8ee; --muted: #8a909c; --muted2: #5f6672;
  --accent: #e4443a; --accent-d: #b83029;
  --green: #35c46a; --amber: #f0a92b; --blue: #4a9be4; --purple: #9b6fe0;
  --radius: 12px; --radius-s: 8px;
  --shadow: 0 6px 24px rgba(0,0,0,.35);
  font-synthesis: none;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
a { color: inherit; text-decoration: none; cursor: pointer; }
button { font: inherit; cursor: pointer; border: none; border-radius: var(--radius-s); }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); padding: 6px 12px; }
button.ghost:hover { color: var(--text); border-color: var(--border2); }
input, select { font: inherit; background: var(--bg2); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 9px 11px; outline: none; }
input:focus, select:focus { border-color: var(--accent); }

/* Brand */
.brand { font-size: 20px; font-weight: 500; letter-spacing: .2px; display: flex; align-items: center; gap: 2px; }
.brand b { font-weight: 800; }
.brand .logo { background: var(--accent); color: #fff; font-weight: 800; font-size: 13px; padding: 2px 6px; border-radius: 6px; margin-right: 6px; }
.brand.sm { font-size: 16px; }
.brand.sm .logo { font-size: 11px; padding: 2px 5px; }

/* Login */
.login { position: fixed; inset: 0; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, #1b2029, var(--bg)); }
.login-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 30px; width: 340px; display: flex; flex-direction: column; gap: 14px; box-shadow: var(--shadow); }
.login-card .brand { justify-content: center; margin-bottom: 4px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.login-card button[type=submit] { background: var(--accent); color: #fff; padding: 11px; font-weight: 600; margin-top: 4px; }
.login-card button[type=submit]:hover { background: var(--accent-d); }
.login-foot { position: fixed; bottom: 18px; font-size: 12px; }
.error { color: var(--accent); font-size: 13px; min-height: 18px; text-align: center; }

/* App shell */
.app { display: flex; flex-direction: column; min-height: 100%; }
.topbar { display: flex; align-items: center; gap: 24px; padding: 0 22px; height: 58px; background: var(--bg2); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20; }
.tabs { display: flex; gap: 4px; flex: 1; }
.tab { padding: 8px 15px; border-radius: 20px; color: var(--muted); font-weight: 500; }
.tab:hover { color: var(--text); background: var(--panel); }
.tab.active { color: #fff; background: var(--accent); }
.topright { display: flex; align-items: center; gap: 14px; }
.live-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted2); transition: background .3s; }
.live-dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
main { flex: 1; padding: 22px; max-width: 1480px; width: 100%; margin: 0 auto; }
.foot { text-align: center; padding: 14px; font-size: 12px; border-top: 1px solid var(--border); }

h1.page { font-size: 22px; margin: 0 0 2px; font-weight: 600; }
.sub { color: var(--muted); font-size: 13px; margin-bottom: 18px; }

/* Cards & grid */
.grid { display: grid; gap: 16px; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); }
.pad { padding: 18px; }

/* Overview stats */
.stat-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat .big { font-size: 30px; font-weight: 700; line-height: 1.1; }
.stat .lbl { color: var(--muted); font-size: 12px; }
.stat.accent .big { color: var(--accent); }
.stat.green .big { color: var(--green); }
.stat.amber .big { color: var(--amber); }
.overview-grid { grid-template-columns: 1fr 320px; margin-top: 16px; align-items: start; }
@media (max-width: 900px) { .overview-grid { grid-template-columns: 1fr; } }

/* Computer cards */
.cards { grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); }
.ccard { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; cursor: pointer; transition: border-color .15s, transform .15s; position: relative; overflow: hidden; }
.ccard:hover { border-color: var(--border2); transform: translateY(-2px); }
.ccard.online { box-shadow: inset 0 0 0 1px rgba(53,196,106,.25); }
.ccard.alert { box-shadow: inset 0 0 0 1px rgba(228,68,58,.45); }
.ccard .hd { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.ccard .name { font-weight: 700; font-size: 15px; }
.ccard .user { color: var(--muted); font-size: 12px; }
.badge { font-size: 11px; padding: 2px 9px; border-radius: 20px; font-weight: 600; }
.badge.online { background: rgba(53,196,106,.15); color: var(--green); }
.badge.offline { background: rgba(228,68,58,.12); color: var(--accent); }
.badge.inactive { background: rgba(138,144,156,.15); color: var(--muted); }
.os-line { font-size: 12px; color: var(--muted); margin-bottom: 12px; }
.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.meter .mlbl { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.meter .mval { font-weight: 700; }
.bar { height: 7px; background: var(--bg2); border-radius: 5px; overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 5px; transition: width .4s; }
.bar.ok > span { background: var(--green); }
.bar.warn > span { background: var(--amber); }
.bar.crit > span { background: var(--accent); }
.ccard .foot { display: flex; justify-content: space-between; margin-top: 13px; padding-top: 11px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }

/* Toolbar */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .search { flex: 1; min-width: 180px; }
.toolbar input[type=search] { width: 100%; }
.chip { padding: 6px 12px; border-radius: 20px; background: var(--panel); border: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Table */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; color: var(--muted); font-weight: 500; padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 12px; position: sticky; top: 58px; background: var(--panel); }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); }
tr:hover td { background: var(--panel2); }
.pill { font-size: 11px; padding: 2px 8px; border-radius: 12px; }
.pill.active { background: rgba(53,196,106,.15); color: var(--green); }
.pill.idle { background: rgba(240,169,43,.15); color: var(--amber); }
.pill.offline { background: rgba(138,144,156,.15); color: var(--muted); }
.pill.permit { background: rgba(53,196,106,.15); color: var(--green); }
.pill.block { background: rgba(228,68,58,.15); color: var(--accent); }

/* Drawer */
.drawer { position: fixed; inset: 0; z-index: 40; }
.drawer-bg { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.drawer-panel { position: absolute; right: 0; top: 0; bottom: 0; width: min(760px, 94vw); background: var(--bg); border-left: 1px solid var(--border); overflow-y: auto; box-shadow: var(--shadow); animation: slide .2s ease; }
@keyframes slide { from { transform: translateX(30px); opacity: .6; } }
.dh { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px 22px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); z-index: 2; }
.dh h2 { margin: 0; font-size: 19px; }
.dbody { padding: 20px 22px; display: flex; flex-direction: column; gap: 20px; }
.subtabs { display: flex; gap: 6px; }
.subtab { padding: 6px 13px; border-radius: 18px; background: var(--panel); color: var(--muted); font-size: 13px; border: 1px solid var(--border); }
.subtab.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 14px; font-size: 13px; }
.kv .k { color: var(--muted); }
.hwcards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.hwcard { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 14px; }
.hwcard .t { font-size: 12px; color: var(--muted); }
.hwcard .v { font-size: 17px; font-weight: 700; margin-top: 4px; }

/* Screenshot gallery */
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.shot { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-s); overflow: hidden; cursor: pointer; }
.shot img { width: 100%; aspect-ratio: 16/9; object-fit: cover; background: #000; display: block; }
.shot .cap { padding: 7px 9px; font-size: 11px; color: var(--muted); display: flex; justify-content: space-between; }
.empty { color: var(--muted); text-align: center; padding: 40px; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.9); display: grid; place-items: center; padding: 30px; }
.lightbox img { max-width: 96vw; max-height: 86vh; border-radius: 6px; }
.lightbox-cap { position: fixed; bottom: 18px; color: #fff; font-size: 13px; }

/* Charts */
.spark { width: 100%; height: 44px; display: block; }
.chart-wrap { width: 100%; overflow: hidden; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 12px; margin-top: 10px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.row { display: flex; gap: 8px; align-items: center; }
.sp { flex: 1; }
