:root{
  --bg:#0b0d10; --shell:#10141a; --text:#e6edf3; --muted:#9aa4b2;
  --blue:#2d6cdf; --blue-hi:#3b82f6; --ring:#1e2a44;
  --ok:#22c55e; --bad:#ef4444; --warn:#f59e0b;
  --control-bg:#0f1520; --control-border:var(--ring);
  --control-height:40px; --control-radius:10px;
  --surface:#0d1220; --surface-hi:#11192a;
}
*{box-sizing:border-box}
html,body{height:100%}
body{margin:0;background:var(--bg);color:var(--text);font:14px/1.45 Inter,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial,"Apple Color Emoji","Segoe UI Emoji"}
.shell{max-width:min(1900px, 99vw);margin:0 auto;padding:16px 20px}
header.shell{display:flex;gap:12px;justify-content:space-between;align-items:center}
.app-header{
  border-bottom:1px solid rgba(45,108,223,.15);
}
.brand{font-weight:700;letter-spacing:.2px;text-decoration:none;color:var(--text)}
.actions{display:flex;flex:1;gap:8px;align-items:center;justify-content:flex-end;flex-wrap:wrap}
.signout-form{margin:0}

input[type=search]{
  background:var(--control-bg);
  border:1px solid var(--control-border);
  color:var(--text);
  border-radius:var(--control-radius);
  padding:8px 10px;
  min-width:220px;
  height:var(--control-height);
  font:inherit;
}

select:not([multiple]):not([size]){
  background:var(--control-bg);
  border:1px solid var(--control-border);
  color:var(--text);
  border-radius:var(--control-radius);
  min-height:var(--control-height);
  padding:0 12px;
  font:inherit;
  line-height:1.3;
}

select[multiple],
select[size]{
  background:var(--control-bg);
  border:1px solid var(--control-border);
  color:var(--text);
  border-radius:var(--control-radius);
  padding:8px 10px;
  min-height:calc(var(--control-height) * 4);
  font:inherit;
  line-height:1.4;
}

#q{min-width:220px}

.btn{border:1px solid var(--control-border);background:var(--control-bg);color:var(--text);padding:0 14px;border-radius:var(--control-radius);cursor:pointer;min-height:var(--control-height);display:inline-flex;align-items:center;justify-content:center;font-weight:600;text-decoration:none;gap:6px}
.btn:hover{border-color:var(--blue)}
.btn-primary{background:var(--blue-hi);border-color:var(--blue-hi);color:#fff}
.btn.ghost{background:transparent}
.meta{display:flex;gap:12px;align-items:center;flex-wrap:wrap;margin:6px 0 12px;color:var(--muted)}
.meta .hint code{background:#0f1520;border:1px solid var(--ring);padding:2px 6px;border-radius:6px}

.grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(300px,1fr));gap:12px}
.card{position:relative;border:1px solid var(--ring);background:linear-gradient(180deg,#0d1220,#0c1017);border-radius:14px;overflow:hidden;box-shadow:0 1px 0 rgba(255,255,255,.04) inset}

/* selection check */
.card .pick{position:absolute;top:10px;left:10px;z-index:3}
.card .pick input{display:none}
.card .pick span{display:inline-block;width:18px;height:18px;border-radius:5px;border:1px solid var(--ring);background:#0f1520}
.card .pick input:checked+span{background:var(--blue-hi);box-shadow:0 0 0 3px rgba(59,130,246,.25)}

/* top blue header like screenshot */
.topbar{height:26px;background:linear-gradient(180deg,#2f6ee4,#2358b9);color:#fff;display:flex;align-items:center;padding:0 6px;gap:6px;border-bottom:1px solid rgba(255,255,255,.15)}
.topbar .num{font-weight:700;background:rgba(255,255,255,.2);padding:2px 6px;border-radius:6px;min-width:30px;text-align:center}
.topbar .brandtag{font-weight:700;letter-spacing:.3px;opacity:.95}
.topbar .state{margin-left:auto;width:8px;height:8px;border-radius:50%;background:var(--ok);box-shadow:0 0 0 2px rgba(0,0,0,.35)}
/* In-use = online from backend, show red; not in use = offline, show green */
.topbar .state.online{background:var(--bad)}

/* desktop-like frame (16:9) */
.screen{position:relative;aspect-ratio:16/9;background:#0f1520}
.screen img,.screen .placeholder{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;z-index:0}
.screen .placeholder{background:linear-gradient(135deg,#1a2030,#121826);pointer-events:none}

/* hover overlay with actions */
.overlay{position:absolute;inset:0;display:flex;flex-direction:column;justify-content:flex-end;gap:8px;padding:10px;background:linear-gradient(180deg,transparent 60%,rgba(0,0,0,.55));z-index:1}
.overlay .title{font-weight:600;text-shadow:0 1px 2px rgba(0,0,0,.5)}
.overlay .cta{display:flex;gap:8px}
.overlay a.btn,.overlay button.btn{font-weight:600}
.card:hover{border-color:#2f6ee4;box-shadow:0 0 0 1px #2f6ee4}

/* auth page */
.auth-wrap{min-height:calc(100vh - 64px);display:grid;place-items:center}
.auth-card{width:100%;max-width:360px;background:linear-gradient(180deg,var(--surface-hi),var(--surface));border:1px solid var(--ring);border-radius:14px;padding:20px;box-shadow:0 1px 0 rgba(255,255,255,.04) inset;overflow-x:auto}
.auth-card h1{margin:0 0 12px;font-size:20px}
.auth-card label{display:flex;flex-direction:column;gap:6px;margin:10px 0}
.auth-card label span{color:var(--muted);font-size:12px}
.auth-card input:not([type=checkbox]):not([type=radio]):not([type=hidden]){
  width:100%;
  padding:10px;
  border-radius:10px;
  border:1px solid var(--ring);
  background:var(--control-bg);
  color:var(--text);
}
.auth-card select{width:100%}
.auth-card select[multiple],.auth-card select[size]{min-height:220px}
.flash.error{border:1px solid #7a1d1d;background:#2a1111;color:#ffb3b3;padding:10px;border-radius:10px;margin:0 0 10px}
.flash.ok{border:1px solid #1d7a3a;background:#112a1c;color:#b3ffd0;padding:10px;border-radius:10px;margin:10px 0 0}
.flash.info{border:1px solid #1e3a8a;background:#0f172a;color:#c7d2fe;padding:10px;border-radius:10px;margin:0 0 10px}
.flash.warn,.flash.warning{border:1px solid #92400e;background:#2a1b0a;color:#ffd7a8;padding:10px;border-radius:10px;margin:0 0 10px}
.flash-stack{display:flex;flex-direction:column;gap:8px;margin:6px 0 12px}

.table-wrap{
  width:100%;
  border:1px solid var(--ring);
  border-radius:12px;
  background:rgba(11,16,24,.75);
  overflow:auto;
}
.table-wrap table,
.auth-card table{
  width:100%;
  border-collapse:separate;
  border-spacing:0;
}
.table-wrap th,
.auth-card table th{
  position:sticky;
  top:0;
  background:rgba(13,18,32,.96);
  z-index:1;
  font-weight:600;
  color:#b6c2d4;
  white-space:nowrap;
}
.table-wrap th,
.table-wrap td,
.auth-card table th,
.auth-card table td{
  padding:10px 10px !important;
  border-bottom:1px solid rgba(30,42,68,.7);
  vertical-align:middle;
}
.auth-card table td{white-space:normal}
.auth-card table tr:last-child td{border-bottom:none}

.inline-form{
  display:flex;
  flex-wrap:wrap;
  gap:8px;
  align-items:center;
}
.inline-form input,
.inline-form select{
  min-width:220px;
}
.inline-form .btn{min-height:36px}

@media (max-width:1160px){
  .app-header{position:static}
}
@media (max-width:920px){
  .shell{padding:14px}
  .actions{justify-content:flex-start}
  #q{min-width:160px;flex:1}
}
@media (max-width:560px){ .grid{grid-template-columns:repeat(2,minmax(0,1fr))} }
