/* HellFireRAT by @Lordy — neon red / gold hell theme */
@import url("https://fonts.googleapis.com/css2?family=Orbitron:wght@600;800&family=JetBrains+Mono:wght@400;600&display=swap");

:root {
  --bg: #080504;
  --bg2: #0e0908;
  --panel: #150c0a;
  --panel2: #1d110e;
  --panel3: #251511;
  --line: #3d1c13;
  --line2: #5a2818;
  --red: #ff2d2d;
  --red-d: #b31212;
  --ember: #ff6a00;
  --gold: #ffc247;
  --gold2: #ffe3a1;
  --text: #f4e8e1;
  --dim: #a48c82;
  --dim2: #6d5a53;
  --ok: #3ddc84;
  --warn: #ffb020;
  --err: #ff4646;
  --fire: linear-gradient(135deg, #ff2d2d 0%, #ff6a00 55%, #ffc247 100%);
  --glow: 0 0 14px rgba(255, 45, 45, 0.35);
  --glow-gold: 0 0 14px rgba(255, 194, 71, 0.3);
  --r: 10px;
  --mono: "JetBrains Mono", "Cascadia Mono", Consolas, monospace;
  --display: "Orbitron", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, sans-serif;
  overflow: hidden;
}

body::before {
  /* ember haze */
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(900px 500px at 12% -10%, rgba(255, 106, 0, 0.16), transparent 60%),
    radial-gradient(700px 420px at 92% 110%, rgba(255, 45, 45, 0.14), transparent 60%),
    radial-gradient(600px 300px at 50% 50%, rgba(255, 194, 71, 0.04), transparent 70%);
  z-index: 0;
}

#app { position: relative; z-index: 1; height: 100%; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0b0706; }
::-webkit-scrollbar-thumb { background: #4a2216; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #6d2f1c; }

/* ------------------------------------------------------------ primitives */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line2);
  background: linear-gradient(180deg, #23140f, #180d0a);
  color: var(--text);
  padding: 7px 13px;
  border-radius: 8px;
  font-size: 13px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
  transition: border-color .15s, box-shadow .15s, transform .08s, background .15s;
}
.btn:hover { border-color: var(--ember); box-shadow: var(--glow); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.primary {
  background: var(--fire); border-color: transparent; color: #1a0603;
  text-shadow: 0 1px 0 rgba(255,255,255,.25);
  box-shadow: 0 0 18px rgba(255, 106, 0, .35);
}
.btn.primary:hover { box-shadow: 0 0 26px rgba(255, 106, 0, .55); }
.btn.danger { border-color: #6d1a1a; color: #ffb3b3; }
.btn.danger:hover { border-color: var(--red); box-shadow: var(--glow); }
.btn.ghost { background: transparent; border-color: var(--line); }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.btn.icon { padding: 6px 8px; }
.btn.active { border-color: var(--gold); color: var(--gold); box-shadow: var(--glow-gold); }

input, select, textarea {
  background: #120b09;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 10px;
  font: inherit;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--ember); box-shadow: 0 0 0 3px rgba(255, 106, 0, .12);
}
label.field { display: block; margin-bottom: 12px; }
label.field > span { display: block; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); margin-bottom: 5px; }
input[type="range"] { padding: 0; accent-color: var(--ember); }
input[type="checkbox"] { width: auto; accent-color: var(--red); }

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 20px;
  border: 1px solid var(--line2); color: var(--dim);
}
.badge.on { color: var(--ok); border-color: #1d5c3a; background: rgba(61, 220, 132, .08); }
.badge.off { color: var(--dim2); }
.badge.gold { color: var(--gold); border-color: #6b4a10; background: rgba(255, 194, 71, .08); }
.badge.red { color: var(--red); border-color: #6d1a1a; background: rgba(255, 45, 45, .08); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim2); display: inline-block; }
.dot.on { background: var(--ok); box-shadow: 0 0 8px var(--ok); animation: pulse 2.4s infinite; }
@keyframes pulse { 0%,100% { opacity: 1 } 50% { opacity: .45 } }

.muted { color: var(--dim); }
.mono { font-family: var(--mono); }
.spacer { flex: 1; }
.hidden { display: none !important; }

/* ------------------------------------------------------------------ login */
.login-wrap { height: 100%; display: grid; place-items: center; }
.login-card {
  width: 380px; padding: 34px 32px 28px;
  background: linear-gradient(180deg, rgba(30,17,14,.96), rgba(16,9,7,.98));
  border: 1px solid var(--line2);
  border-radius: 16px;
  box-shadow: 0 0 60px rgba(255, 45, 45, .18), inset 0 1px 0 rgba(255, 194, 71, .08);
  position: relative; overflow: hidden;
}
.login-card::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 2px; background: var(--fire);
  box-shadow: 0 0 18px rgba(255, 106, 0, .8);
}
.login-card h1 { font-family: var(--display); font-size: 22px; letter-spacing: .06em; margin: 0 0 4px; }
.login-card .sub { color: var(--dim); font-size: 12px; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 24px; }

/* ------------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 224px 1fr; grid-template-rows: 56px 1fr; height: 100%; }
.topbar {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 16px; padding: 0 18px;
  background: linear-gradient(180deg, rgba(28,15,12,.95), rgba(14,8,7,.95));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(6px);
}
.brand { display: flex; align-items: center; gap: 10px; user-select: none; }
.brand svg { filter: drop-shadow(0 0 8px rgba(255,106,0,.75)); }
.brand-name { font-family: var(--display); font-weight: 800; font-size: 17px; letter-spacing: .1em; }
.brand-name b { background: var(--fire); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-by { font-size: 10px; letter-spacing: .22em; color: var(--dim2); text-transform: uppercase; }

.rail {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(18,10,8,.7), rgba(10,6,5,.9));
  padding: 12px 10px; overflow-y: auto;
}
.rail-title { font-size: 10px; letter-spacing: .18em; text-transform: uppercase; color: var(--dim2); margin: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 11px; border-radius: 8px; cursor: pointer;
  color: var(--dim); font-weight: 600; font-size: 13.5px;
  border: 1px solid transparent;
}
.nav-item:hover { background: rgba(255, 106, 0, .06); color: var(--text); }
.nav-item.active {
  color: var(--gold); background: linear-gradient(90deg, rgba(255, 106, 0, .16), rgba(255, 106, 0, .02));
  border-color: var(--line2);
  box-shadow: inset 3px 0 0 var(--ember);
}
.nav-item .count { margin-left: auto; font-size: 11px; color: var(--dim2); font-family: var(--mono); }
.nav-item svg { opacity: .85; flex: none; }

.main { overflow: auto; padding: 20px 22px 40px; position: relative; }

/* ----------------------------------------------------------------- cards */
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 18px; }
.page-head h2 { font-family: var(--display); font-size: 19px; letter-spacing: .08em; margin: 0; }
.page-head .desc { color: var(--dim); font-size: 12.5px; }

.card {
  background: linear-gradient(180deg, rgba(26,15,12,.92), rgba(18,10,8,.92));
  border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden;
}
.card-h {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 15px; border-bottom: 1px solid var(--line);
  font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim);
}
.card-b { padding: 15px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat {
  background: linear-gradient(180deg, #1b0f0c, #120a08);
  border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px;
  position: relative; overflow: hidden;
}
.stat::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--fire); opacity: .7; }
.stat .v { font-family: var(--display); font-size: 26px; font-weight: 800; line-height: 1.1; }
.stat .k { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--dim); margin-top: 4px; }

/* -------------------------------------------------------------- machines */
.machine-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.machine {
  background: linear-gradient(180deg, #1a0f0c, #100908);
  border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; cursor: pointer; transition: border-color .15s, box-shadow .15s, transform .1s;
}
.machine:hover { border-color: var(--ember); box-shadow: var(--glow); transform: translateY(-2px); }
.machine.on { border-color: #4a2318; }
.machine-thumb {
  height: 128px; background: #050302 center/cover no-repeat; position: relative;
  border-bottom: 1px solid var(--line);
  display: grid; place-items: center;
}
.machine-thumb .placeholder { color: #2b1712; }
.machine-thumb .live { position: absolute; top: 8px; left: 8px; }
.machine-body { padding: 10px 12px; }
.machine-host { font-weight: 700; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.machine-sub { color: var(--dim); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------------------------------------------------------- tables */
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; font-size: 10px; letter-spacing: .14em; text-transform: uppercase;
  color: var(--dim2); padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 700;
}
table.tbl td { padding: 7px 10px; border-bottom: 1px solid rgba(61, 28, 19, .5); }
table.tbl tr:hover td { background: rgba(255, 106, 0, .045); }
table.tbl tr.sel td { background: rgba(255, 106, 0, .1); }

/* --------------------------------------------------------------- toolbar */
.toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 9px 12px; background: rgba(20, 11, 9, .85);
  border-bottom: 1px solid var(--line);
}
.toolbar .sep { width: 1px; height: 20px; background: var(--line); margin: 0 4px; }
.tb-label { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--dim2); }

/* ---------------------------------------------------------------- remote */
.remote { display: grid; grid-template-columns: 1fr 460px; grid-template-rows: auto auto 1fr; height: 100%; }
.remote-toolbar { grid-column: 1 / -1; }
.viewer-wrap {
  background: #040202; position: relative; overflow: hidden;
  display: grid; place-items: center;
}
.viewer-wrap canvas { display: block; max-width: 100%; max-height: 100%; cursor: crosshair; image-rendering: -webkit-optimize-contrast; }
.viewer-wrap.locked canvas { cursor: not-allowed; }
.viewer-overlay {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: radial-gradient(circle at center, rgba(20,10,8,.55), rgba(5,3,2,.9));
  color: var(--dim); text-align: center;
}
.viewer-overlay .big { font-family: var(--display); font-size: 17px; color: var(--gold); letter-spacing: .1em; }
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid rgba(255, 106, 0, .2); border-top-color: var(--ember);
  animation: spin .8s linear infinite; margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg) } }

.dock { display: flex; flex-direction: column; background: var(--bg2); border-left: 1px solid var(--line); min-height: 0; }
.tabs { display: flex; flex-wrap: wrap; border-bottom: 1px solid var(--line); background: #120a08; }
.tab {
  padding: 7px 11px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: var(--dim); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--gold); border-bottom-color: var(--ember); background: rgba(255, 106, 0, .06); }
.tab-body { flex: 1; overflow: auto; min-height: 0; }
.tab-pane { padding: 12px; }
.tab-pane.flush { padding: 0; }

/* -------------------------------------------------------------- terminal */
.term {
  background: #070404; font-family: var(--mono); font-size: 12.5px; line-height: 1.5;
  padding: 10px; height: 100%; overflow-y: auto; white-space: pre-wrap; word-break: break-word;
  color: #d9cfc9;
}
.term .err { color: #ff8b8b; }
.term .cmd { color: var(--gold); }
.term-input-row { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); background: #0d0807; }
.term-input-row input { font-family: var(--mono); font-size: 12.5px; }

/* ------------------------------------------------------------- file list */
.files { display: grid; grid-template-rows: auto 1fr auto; height: 100%; min-height: 0; }
.files-path { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); }
.file-scroll { overflow: auto; }
.frow { display: grid; grid-template-columns: 20px 1fr 78px; gap: 8px; padding: 5px 10px; cursor: pointer; font-size: 12.5px; align-items: center; }
.frow:hover { background: rgba(255, 106, 0, .07); }
.frow .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frow .sz { text-align: right; color: var(--dim2); font-family: var(--mono); font-size: 11px; }
.frow .ico { opacity: .8; }

/* ------------------------------------------------------------------- kv */
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 4px 10px; font-size: 12.5px; }
.kv b { color: var(--dim); font-weight: 600; }
.kv span { word-break: break-word; }

/* ---------------------------------------------------------------- toasts */
.toast-host { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 999; }
.toast {
  min-width: 220px; max-width: 380px; padding: 10px 14px; border-radius: 9px;
  background: linear-gradient(180deg, #24140f, #150c09);
  border: 1px solid var(--line2); box-shadow: 0 10px 30px rgba(0,0,0,.6);
  font-size: 13px; animation: slidein .2s ease-out;
}
.toast.err { border-color: #7a2020; box-shadow: 0 0 20px rgba(255,45,45,.25); }
.toast.ok { border-color: #1d5c3a; }
@keyframes slidein { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }

/* ----------------------------------------------------------------- modal */
.modal-host { position: fixed; inset: 0; background: rgba(4,2,2,.72); display: grid; place-items: center; z-index: 900; backdrop-filter: blur(3px); }
.modal { width: 460px; max-width: 92vw; max-height: 86vh; overflow: auto; background: #17100d; border: 1px solid var(--line2); border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.7); }
.modal-h { padding: 14px 18px; border-bottom: 1px solid var(--line); font-family: var(--display); letter-spacing: .08em; font-size: 14px; }
.modal-b { padding: 16px 18px; }
.modal-f { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

/* ------------------------------------------------------------- keylogger */
.kl-list { font-family: var(--mono); font-size: 12px; }
.kl-row { padding: 6px 10px; border-bottom: 1px solid rgba(61,28,19,.45); }
.kl-row .w { color: var(--gold); font-size: 11px; }
.kl-row .k { color: #d9cfc9; word-break: break-word; }

/* ---------------------------------------------------------------- builder */
.builder { display: grid; grid-template-columns: 1fr 320px; gap: 16px; align-items: start; }
.chk { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; }
.chk input { width: 15px; height: 15px; }
.fire-divider { height: 1px; background: linear-gradient(90deg, transparent, var(--ember), transparent); margin: 14px 0; opacity: .5; }

/* --------------------------------------------------------------- scrollbar rail */
.rail .mini {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 6px;
  font-size: 12.5px; color: var(--dim); cursor: pointer;
}
.rail .mini:hover { background: rgba(255,106,0,.07); color: var(--text); }
.rail .mini.online .dot { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.rail .mini .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1100px) {
  .remote { grid-template-columns: 1fr; }
  .dock { max-height: 40vh; }
  .shell { grid-template-columns: 68px 1fr; }
  .nav-item span.lbl, .rail-title, .rail .mini .nm { display: none; }
}

/* =====================================================================
   Refine layer - same palette, tighter and more professional.
   Appended so every rule above keeps working; these only sharpen it.
   ===================================================================== */

:root {
  --r-sm: 7px;
  --r-md: 10px;
  --r-lg: 14px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.5), 0 6px 18px rgba(0,0,0,.35);
  --shadow-2: 0 2px 6px rgba(0,0,0,.55), 0 16px 40px rgba(0,0,0,.45);
  --ring: 0 0 0 2px rgba(255,138,26,.45);
  --hz: rgba(255,255,255,.045);
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv02","cv03","cv04","tnum";
}

/* numbers in tables/stat cards line up */
.mono, .tbl td.mono, .stat .v, .machine-sub, .kpi .v { font-variant-numeric: tabular-nums; }

/* keyboard users get a visible target */
:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--ring);
  border-radius: var(--r-sm);
}

/* ---------------------------------------------------------------- cards */
.card {
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(29,17,14,.92), rgba(21,12,10,.96));
  box-shadow: var(--shadow-1), inset 0 1px 0 var(--hz);
  overflow: hidden;
}
.card-h {
  padding: 11px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gold);
  background: linear-gradient(180deg, rgba(255,106,0,.07), transparent);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-b { padding: 14px; }

/* --------------------------------------------------------------- tables */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.tbl thead th {
  position: sticky; top: 0; z-index: 1;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--dim2);
  padding: 9px 12px;
  background: var(--panel2);
  border-bottom: 1px solid var(--line2);
  white-space: nowrap;
}
.tbl tbody td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr { transition: background .12s ease; }
.tbl tbody tr:hover { background: rgba(255,106,0,.05); }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl th.n, .tbl td.n { text-align: right; }

/* -------------------------------------------------------------- buttons */
.btn { border-radius: var(--r-sm); transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .08s ease; }
.btn.sm { height: 26px; padding: 0 10px; display: inline-flex; align-items: center; gap: 5px; }
.btn.primary { border-radius: var(--r-sm); }

/* --------------------------------------------------------------- badges */
.badge {
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  padding: 3px 8px;
  line-height: 1.5;
}

/* ------------------------------------------------------------- machines */
.machine {
  position: relative;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(29,17,14,.9), rgba(16,9,8,.96));
  transition: transform .14s ease, border-color .14s ease, box-shadow .14s ease;
  overflow: hidden;
}
.machine:hover { transform: translateY(-2px); border-color: var(--ember); box-shadow: var(--shadow-2), var(--glow); }
.machine.on { border-color: #4a2318; box-shadow: inset 0 0 0 1px rgba(61,220,132,.14); }

/* delete: quiet until you hover the card */
.machine-del {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  border: 1px solid #6d1a1a;
  background: rgba(12,6,5,.82);
  color: #ff8f8f;
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .14s ease, transform .14s ease, background .14s ease, color .14s ease;
  cursor: pointer;
  backdrop-filter: blur(3px);
}
.machine:hover .machine-del { opacity: 1; transform: none; }
.machine-del:hover { background: var(--red); color: #fff; box-shadow: var(--glow); }
.machine-del:focus-visible { opacity: 1; }

.machine-thumb { border-bottom: 1px solid var(--line); }
.machine-host { letter-spacing: -.01em; }
.machine-body { padding: 11px 13px; }

/* ------------------------------------------------------------- page head */
.page-head { align-items: baseline; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.page-head h2 { font-size: 15px; letter-spacing: .2em; font-weight: 800; }
.page-head .desc { font-size: 11.5px; color: var(--dim2); }

/* -------------------------------------------------------------- toolbar */
.toolbar { gap: 7px; padding: 8px 10px; }
.toolbar .btn.sm { height: 26px; }

/* ----------------------------------------------------------- scrollbars */
* { scrollbar-width: thin; scrollbar-color: #4a2318 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #3a1c15; border-radius: 999px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #5a2818; background-clip: content-box; }

/* --------------------------------------------------------- motion / a11y */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
@media (hover: none) {
  .machine-del { opacity: 1; transform: none; }   /* touch: always visible */
}

/* =====================================================================
   Flat pass - same palette, square corners, no clipping.
   Loaded last so it overrides the rounded values above.
   ===================================================================== */

:root {
  --r: 0px;
  --r-sm: 0px;
  --r-md: 0px;
  --r-lg: 0px;
  --shadow-1: 0 1px 0 rgba(255,255,255,.03) inset, 0 2px 8px rgba(0,0,0,.45);
  --shadow-2: 0 1px 0 rgba(255,255,255,.04) inset, 0 10px 26px rgba(0,0,0,.55);
  --ring: 0 0 0 2px rgba(255,138,26,.55);
}

/* --- square everything: cards, buttons, inputs, badges, tiles ---------- */
.card, .card-h, .card-b,
.btn, .btn.sm, .btn.primary, .btn.danger, .btn.ghost, .btn.icon,
.badge, .machine, .machine-del, .machine-thumb,
input, select, textarea, .field input, .field select,
.rail .mini, .nav-item, .tab, .dock, .modal, .modal *,
.remote .card, .files, .kv, .tbl, .tbl-wrap {
  border-radius: 0%;
}
.card, .btn, .badge, .machine, .machine-del, input, select, textarea,
.rail .mini, .nav-item, .tab, .modal { border-radius: 0px; }

/* --- cards: flat surface, square, accent bar instead of glow ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0;
  box-shadow: none;
  overflow: visible;              /* was clipping wide content */
}
.card-h {
  padding: 10px 14px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--panel2);
  border-bottom: 1px solid var(--line);
  border-left: 2px solid var(--ember);
  display: flex;
  align-items: center;
  gap: 8px;
}
.card-b { padding: 16px; }
.card-b.tight { padding: 0; }

/* --- buttons: solid rectangles, no glow ------------------------------ */
.btn {
  border-radius: 0;
  border: 1px solid var(--line2);
  background: var(--panel2);
  color: var(--text);
  box-shadow: none;
  font-weight: 600;
  letter-spacing: .02em;
}
.btn:hover { border-color: var(--ember); background: var(--panel3); box-shadow: none; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  background: var(--fire);
  border-color: transparent;
  color: #180503;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.btn.primary:hover { filter: brightness(1.08); box-shadow: none; }
.btn.sm { height: 26px; padding: 0 10px; }
.btn.icon { padding: 6px 8px; }

/* --- badges: small square tags ---------------------------------------- */
.badge {
  border-radius: 0;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  padding: 2px 6px;
  line-height: 1.6;
}

/* --- inputs ----------------------------------------------------------- */
input, select, textarea {
  border-radius: 0;
  border: 1px solid var(--line2);
  background: var(--bg2);
  color: var(--text);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--ember);
  box-shadow: var(--ring);
}

/* --- machine tiles: square, lift on hover, no rounded corners --------- */
.machine { border-radius: 0; background: var(--panel); }
.machine:hover { transform: none; border-color: var(--ember); box-shadow: 0 0 0 1px var(--ember) inset; }
.machine-del { border-radius: 0; }

/* --- tables: square, scroll instead of clip --------------------------- */
.tbl-wrap { width: 100%; overflow-x: auto; }
.tbl-wrap .tbl { min-width: 720px; }
.tbl { border-radius: 0; }
.tbl thead th { background: var(--panel2); }

/* --- builder: one column, full width table below --------------------- */
.builder { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-items: start; }
.form-grid { display: grid; gap: 10px; }
.form-grid.three { grid-template-columns: minmax(0,1.2fr) minmax(0,1.6fr) 110px; }
.chk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 18px; }
.sub-h {
  font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase;
  color: var(--dim); margin-bottom: 8px;
}
.fire-divider { height: 1px; background: var(--line); margin: 16px 0; opacity: 1; }

/* --- tabs / nav: square selection ------------------------------------- */
.tab, .nav-item { border-radius: 0; }
.rail .mini { border-radius: 0; }

@media (max-width: 900px) {
  .form-grid.three { grid-template-columns: minmax(0,1fr); }
}

/* ------------------------------------------------- ransom wallpaper picker */
.wall-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 12px; }
.wall {
  display: block; padding: 0; text-align: left; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel2); border-radius: 0;
  overflow: hidden; transition: border-color .12s ease, box-shadow .12s ease;
}
.wall:hover { border-color: var(--ember); }
.wall.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); }
.wall-img {
  position: relative; aspect-ratio: 16 / 9; background: var(--bg2);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
}
.wall-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.wall-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 10px; border-top: 1px solid var(--line); background: var(--panel);
}
.wall-name { font-size: 12px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall-tag {
  flex: none; font-size: 9px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--dim2); border: 1px solid var(--line2); padding: 2px 6px; border-radius: 0;
}
.wall.on .wall-tag { color: #180503; background: var(--gold); border-color: transparent; }

/* ------------------------------------------------------- android disguises */
.disc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.disc {
  text-align: left; padding: 10px; cursor: pointer; border-radius: 0;
  border: 1px solid var(--line); background: var(--panel2); color: var(--text);
  transition: border-color .12s ease, background .12s ease;
}
.disc:hover { border-color: var(--ember); background: var(--panel3); }
.disc.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: var(--panel3); }
.disc-glyph { font-size: 20px; line-height: 1.1; margin-bottom: 6px; }
.disc-label { font-size: 12.5px; font-weight: 700; margin-bottom: 2px; }
.disc-desc { font-size: 10.5px; color: var(--dim); line-height: 1.45; }
.disc.on .disc-label { color: var(--gold); }

/* =====================================================================
   Live session pass - wider dock, second toolbar row, dumps tab.
   ===================================================================== */

.remote.dock-hidden { grid-template-columns: 1fr; }
.remote.dock-hidden .dock { display: none; }

.remote-toolbar.sub { padding: 6px 12px; background: rgba(26,14,10,.6); }
.tb-group { display: flex; align-items: center; gap: 6px; }

/* per-machine dump quick action — quiet like .machine-del */
.machine-dump {
  position: absolute; top: 8px; right: 40px; z-index: 3;
  width: 26px; height: 26px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--line2);
  background: rgba(12,6,5,.82);
  color: var(--dim);
  opacity: 0;
  transform: translateY(-2px);
  transition: opacity .14s ease, transform .14s ease, background .14s ease, color .14s ease;
  cursor: pointer;
  backdrop-filter: blur(3px);
}
.machine:hover .machine-dump { opacity: 1; transform: none; }
.machine-dump:hover { background: var(--panel3); color: var(--gold); }
.machine-dump:focus-visible { opacity: 1; }
@media (hover: none) { .machine-dump { opacity: 1; transform: none; } }

/* dumps tab history rows */
.dump-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid rgba(61,28,19,.45);
}
.dump-row:hover { background: rgba(255,106,0,.05); }
.dump-row .meta { flex: 1; min-width: 0; }
.dump-row .acts { display: flex; gap: 4px; }

/* =====================================================================
   Mailer page — campaign wizard, preset browser, framed previews.
   Everything is width-constrained so nothing leaves the viewport.
   ===================================================================== */

.main.mailer-main { max-width: 1280px; margin: 0 auto; width: 100%; }
.mailer-page { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mailer-page > * { min-width: 0; }
.mailer-subnav { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: -4px; }
.mailer-hint { font-size: 11px; }
.mailer-tabs { display: flex; gap: 3px; border-bottom: 1px solid var(--line); flex: 1 1 auto; min-width: 0; }
.mailer-tab {
  padding: 9px 15px; font-size: 12px; font-weight: 700; letter-spacing: .04em;
  color: var(--dim); background: none; border: 0; border-bottom: 2px solid transparent;
  cursor: pointer; white-space: nowrap;
}
.mailer-tab:hover { color: var(--text); }
.mailer-tab.active { color: var(--gold); border-bottom-color: var(--ember); background: rgba(255,106,0,.06); }
.mailer-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.mailer-page .tbl-wrap { overflow-x: auto; max-width: 100%; }
.mailer-page td, .mailer-page th { overflow-wrap: anywhere; }
.nowrap { white-space: nowrap; }
.badges-row { display: flex; gap: 5px; margin-top: 4px; flex-wrap: wrap; }

.tpl-tools { display: grid; grid-template-columns: minmax(0,1fr) 210px; gap: 10px; padding: 10px 12px 4px; }
.mailer-split {
  display: grid; grid-template-columns: minmax(0,1fr) 430px; gap: 12px;
  padding: 8px 12px 12px; align-items: start; min-width: 0;
}
.tpl-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr));
  gap: 8px; max-height: 62vh; overflow: auto; padding: 2px; min-width: 0;
}
.tpl-card {
  position: relative; text-align: left; padding: 10px 11px; border-radius: 9px;
  border: 1px solid var(--line); background: rgba(255,255,255,.02);
  cursor: pointer; min-width: 0; transition: border-color .12s ease, background .12s ease;
}
.tpl-card:hover { border-color: var(--ember); background: rgba(255,106,0,.05); }
.tpl-card.on { border-color: var(--gold); box-shadow: inset 0 0 0 1px var(--gold); background: rgba(255,138,26,.08); }
.tpl-card-top { display: flex; gap: 6px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.tpl-badge { font-size: 9.5px; letter-spacing: .06em; }
.tpl-cat { font-size: 10px; }
.tpl-name { font-size: 12.5px; font-weight: 700; margin-top: 6px; overflow-wrap: anywhere; }
.tpl-org { font-size: 10.5px; color: var(--dim); margin-top: 2px; overflow-wrap: anywhere; }
.tpl-subj {
  font-size: 11px; line-height: 1.45; margin-top: 5px; font-style: italic;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tpl-on { position: absolute; top: 8px; right: 8px; font-size: 9px; }
.tpl-empty {
  grid-column: 1 / -1; padding: 26px 14px; border: 1px dashed var(--line);
  border-radius: 9px; font-size: 12.5px; text-align: center;
}
.tpl-preview {
  position: sticky; top: 10px; border: 1px solid var(--line); border-radius: 9px;
  background: var(--panel2); padding: 11px; min-width: 0;
}
.tpl-preview-h { min-width: 0; }
.tpl-preview .badge { margin-bottom: 5px; }
.tpl-frame-wrap { position: relative; min-width: 0; }
.tpl-frame {
  display: block; width: 100%; height: 52vh; border: 1px solid var(--line);
  background: #fff; border-radius: 4px; max-width: 100%;
}
.tpl-frame.mobile { width: 375px; max-width: 100%; margin: 0 auto; }
.tpl-frame-empty {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  padding: 18px; border: 1px dashed var(--line); border-radius: 4px; color: var(--dim);
}
.modal:has(.tpl-frame) { width: 720px; max-width: 94vw; }

@media (max-width: 1180px) {
  .mailer-split { grid-template-columns: 1fr; }
  .tpl-preview { position: static; }
  .tpl-grid { max-height: none; }
}
@media (max-width: 700px) {
  .tpl-tools { grid-template-columns: 1fr; }
  .mailer-tabs { flex-wrap: wrap; }
}

.mailer-page .page-head { flex-wrap: wrap; gap: 8px 12px; }
.mailer-page h2 { min-width: 0; }

.tpl-logo { display:block; height:24px; width:auto; max-width:70px; margin-top:7px; object-fit:contain; }


/* =====================================================================
   MOBILE — drawer nav, stacked layouts, full-width modals, touch targets.
   Everything below only applies on small screens / touch devices.
   ===================================================================== */

html { -webkit-text-size-adjust: 100%; }
body { overscroll-behavior-y: none; }

.burger {
  display: none; width: 38px; height: 34px; flex: 0 0 auto;
  flex-direction: column; justify-content: center; gap: 5px;
  background: transparent; border: 1px solid var(--line2); border-radius: 8px;
  padding: 0 9px; cursor: pointer;
}
.burger span { display: block; height: 2px; background: var(--text); border-radius: 2px; }
.nav-scrim { display: none; }

@media (max-width: 820px) {
  .burger { display: flex; }
  .topbar { gap: 10px; padding: 0 12px; height: 52px; }
  .brand { gap: 8px; }
  .brand-name { font-size: 15px; }
  .brand-by { display: none; }
  .topbar .badge, .topbar .muted { display: none; }
  .topbar > .btn { margin-left: auto; }

  .shell { grid-template-columns: 1fr; grid-template-rows: 52px 1fr; }
  .rail {
    position: fixed; top: 52px; bottom: 0; left: 0; width: 78vw; max-width: 300px;
    z-index: 60; transform: translateX(-102%); transition: transform .18s ease;
    padding: 10px 8px calc(16px + env(safe-area-inset-bottom));
    background: #120a08; box-shadow: 18px 0 40px rgba(0,0,0,.55);
    overflow-y: auto;
  }
  body.nav-open .rail { transform: none; }
  body.nav-open .nav-scrim {
    display: block; position: fixed; inset: 52px 0 0; z-index: 55;
    background: rgba(4,2,2,.55); backdrop-filter: blur(2px);
  }
  .nav-item { padding: 12px 12px; font-size: 14px; border-radius: 9px; }
  .nav-item .lbl { display: inline !important; }
  .rail-title { margin-top: 10px; }
  .rail-agents { padding-bottom: 40px; }

  .main { padding: 14px 12px calc(28px + env(safe-area-inset-bottom)); }
  .page-head { flex-wrap: wrap; align-items: center; gap: 8px 10px; }
  .page-head h2 { font-size: 16px; }
  .page-head .desc { flex-basis: 100%; order: 5; font-size: 11.5px; }
  .page-head .spacer { display: none; }
  .page-head .btn { padding: 8px 12px; }

  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)) !important; gap: 8px; }
  .stat { padding: 10px; }
  .stat .v { font-size: 20px; }
  .card-b { padding: 12px; }
  .card-b.tight { padding: 6px; }

  .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tbl { min-width: 620px; }
  .tbl th, .tbl td { padding: 8px 9px; font-size: 12px; }

  .form-grid, .form-grid.three, .form-grid.two { grid-template-columns: 1fr !important; }
  .builder { grid-template-columns: 1fr !important; }
  .chk-grid { grid-template-columns: 1fr !important; }
  input, select, textarea { font-size: 16px !important; }
  .btn { min-height: 34px; }
  .btn.sm { min-height: 30px; }

  .modal-host { align-items: center; padding: 10px; }
  .modal { width: 100% !important; max-width: 100% !important; max-height: 92vh; border-radius: 12px; }
  .modal-f .btn { flex: 1; justify-content: center; }
  .toast-host { left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }

  .login-wrap { padding: 16px; }
  .login-card { width: 100%; max-width: 420px; }

  /* live session: viewer on top, dock as a bottom sheet, toolbar wraps */
  .remote { display: flex; flex-direction: column; height: 100%; }
  .remote-toolbar { padding: 7px 8px; gap: 6px; }
  .remote-toolbar .tb-label, .remote-toolbar .sep { display: none; }
  .viewer-wrap { flex: 1 1 auto; min-height: 38vh; }
  .viewer-wrap canvas { touch-action: none; }
  .dock { flex: 0 0 46vh; max-height: 46vh; border-left: 0; border-top: 1px solid var(--line); }
  .tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .tab { padding: 10px 12px; font-size: 12.5px; }
  .remote.dock-hidden .dock { display: none; }

  .mailer-split { grid-template-columns: 1fr !important; }
  .tpl-tools { grid-template-columns: 1fr !important; }
  .tpl-grid { max-height: none; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
  .tpl-preview { position: static; }
  .mailer-tabs { flex-wrap: nowrap; overflow-x: auto; }
  .mailer-page { gap: 10px; }

  .machine { min-height: 104px; }
  .kv { grid-template-columns: 92px 1fr; }
}

@media (max-width: 420px) {
  .stat-grid { grid-template-columns: 1fr 1fr !important; }
  .topbar .brand-name { font-size: 13px; }
  .brand svg, .brand span[html] { width: 20px; height: 20px; }
  .page-head h2 { font-size: 15px; }
  .tbl { min-width: 560px; }
}

@media (display-mode: standalone) {
  .topbar { padding-top: env(safe-area-inset-top); height: calc(52px + env(safe-area-inset-top)); }
  .shell { grid-template-rows: calc(52px + env(safe-area-inset-top)) 1fr; }
  .rail { top: calc(52px + env(safe-area-inset-top)); }
  .nav-scrim { inset: calc(52px + env(safe-area-inset-top)) 0 0 !important; }
}
