:root {
  --bg: #04060a;
  --bg-deep: #020306;
  --surface: rgba(16, 22, 32, .72);
  --surface-2: rgba(24, 32, 46, .72);
  --surface-3: rgba(34, 44, 62, .85);
  --solid: #0b1119;
  --solid-2: #0f1620;
  --fg: #e9f0f7;
  --muted: #8a97aa;
  --faint: #596475;
  --line: rgba(137, 167, 205, .12);
  --line-2: rgba(137, 167, 205, .22);
  --accent: #27f59a;
  --accent-2: #39d8ff;
  --accent-ink: #001810;
  --danger: #ff5d57;
  --warn: #f5c451;
  --glow: 0 0 22px rgba(39, 245, 154, .22);
  --glow-cyan: 0 0 22px rgba(57, 216, 255, .20);
  --radius: 12px;
  --radius-lg: 16px;
  --shadow: 0 24px 60px -16px rgba(0, 0, 0, .75);
  --mono: ui-monospace, "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--fg); font-size: 14px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  position: relative;
}
/* ambient background: twin neon glows + faint grid */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background:
    radial-gradient(900px 540px at 12% -8%, rgba(39, 245, 154, .10), transparent 60%),
    radial-gradient(900px 560px at 92% 0%, rgba(57, 216, 255, .09), transparent 58%),
    radial-gradient(700px 700px at 50% 120%, rgba(39, 245, 154, .05), transparent 60%),
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px),
    var(--bg-deep);
  background-size: auto, auto, auto, 44px 44px, 44px 44px, auto;
  background-position: center;
  mask-image: radial-gradient(1400px 900px at 50% 40%, #000 60%, transparent 100%);
}
/* subtle CRT scanlines */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,.012) 0 1px, transparent 1px 3px);
}

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
b { font-weight: 650; color: #f3f7fb; }
code { font-family: var(--mono); background: rgba(137,167,205,.1); padding: 1px 5px; border-radius: 5px; font-size: 12px; }
input, button, textarea, select { font-family: inherit; }
::selection { background: rgba(39,245,154,.3); color: #fff; }

/* icons */
.ic { width: 18px; height: 18px; display: inline-block; vertical-align: -3px; color: currentColor; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 30px; height: 30px; }
.ic.xl { width: 48px; height: 48px; }
.ic.ghost { opacity: .25; margin-left: -10px; }

/* glitch wordmark */
.glitch { position: relative; display: inline-block; }
.glitch::before, .glitch::after {
  content: attr(data-text); position: absolute; left: 0; top: 0; width: 100%; overflow: hidden; pointer-events: none;
}
.glitch::before { color: var(--accent-2); clip-path: inset(0 0 56% 0); animation: glT 3s infinite steps(2) alternate; opacity: .9; }
.glitch::after { color: var(--danger); clip-path: inset(56% 0 0 0); animation: glB 2.6s infinite steps(2) alternate; opacity: .7; }
@keyframes glT { 0%,92%,100% { transform: translate(0,0); } 94% { transform: translate(-2px,-1px); } 97% { transform: translate(2px,1px); } }
@keyframes glB { 0%,90%,100% { transform: translate(0,0); } 93% { transform: translate(2px,1px); } 96% { transform: translate(-2px,0); } }

/* buttons */
.btn-primary, .btn-ghost {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  border-radius: 10px; padding: 10px 17px; font-size: 14px; font-weight: 650; cursor: pointer;
  border: 1px solid transparent; transition: transform .1s, box-shadow .15s, background .15s, border-color .15s, color .15s;
}
.btn-primary {
  color: var(--accent-ink);
  background: linear-gradient(180deg, #4dffb0, var(--accent));
  box-shadow: 0 6px 18px -6px rgba(39,245,154,.5), inset 0 1px 0 rgba(255,255,255,.35);
}
.btn-primary:hover { box-shadow: 0 8px 26px -6px rgba(39,245,154,.7), inset 0 1px 0 rgba(255,255,255,.4); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); filter: brightness(.96); }
.btn-ghost { background: rgba(137,167,205,.05); border-color: var(--line-2); color: var(--muted); }
.btn-ghost:hover { color: var(--fg); border-color: var(--accent); background: rgba(39,245,154,.07); }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: none; color: var(--muted); cursor: pointer;
  padding: 7px; border-radius: 9px; transition: background .12s, color .12s, box-shadow .12s;
}
.icon-btn:hover { color: var(--accent); background: rgba(39,245,154,.08); box-shadow: inset 0 0 0 1px rgba(39,245,154,.18); }
.icon-btn.danger:hover { color: var(--danger); background: rgba(255,93,87,.1); box-shadow: inset 0 0 0 1px rgba(255,93,87,.2); }

/* ---- toasts ---- */
.toasts { position: fixed; top: 18px; right: 18px; z-index: 400; display: flex; flex-direction: column; gap: 10px; }
.toast {
  background: var(--surface-3); border: 1px solid var(--line-2); border-left: 3px solid var(--accent-2);
  border-radius: 10px; padding: 12px 15px; min-width: 240px; max-width: 380px;
  box-shadow: var(--shadow); backdrop-filter: blur(14px); animation: toastIn .2s cubic-bezier(.2,.9,.3,1); font-size: 13px;
}
.toast.ok { border-left-color: var(--accent); }
.toast.err { border-left-color: var(--danger); }
.toast.warn { border-left-color: var(--warn); }
.toast.fade { animation: toastOut .25s forwards; }
@keyframes toastIn { from { transform: translateX(24px); opacity: 0; } }
@keyframes toastOut { to { transform: translateX(24px); opacity: 0; } }

/* ============================ BOOT / HACKER LOADING SCREEN ============================ */
#boot {
  position: fixed; inset: 0; z-index: 1000; background: var(--bg-deep);
  display: grid; place-items: center; overflow: hidden;
  transition: opacity .5s ease, filter .5s ease;
}
#boot.boot-done { opacity: 0; filter: blur(6px); pointer-events: none; }
#bootRain { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .38; }
#boot .boot-vignette { position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(60% 55% at 50% 45%, transparent 40%, rgba(2,3,6,.82) 100%); }
#boot .boot-scan { position: absolute; inset: 0; pointer-events: none; opacity: .5;
  background: repeating-linear-gradient(to bottom, rgba(39,245,154,.03) 0 1px, transparent 1px 3px); }
.boot-stage { position: relative; z-index: 2; width: min(640px, calc(100vw - 40px)); display: flex; flex-direction: column; align-items: center; gap: 22px; }
.boot-brand { font-family: var(--mono); font-weight: 800; font-size: clamp(42px, 9vw, 74px); letter-spacing: .14em;
  color: var(--fg); text-shadow: 0 0 28px rgba(39,245,154,.45); }
.boot-card {
  width: 100%; background: var(--surface); border: 1px solid rgba(39,245,154,.28); border-radius: 14px;
  box-shadow: 0 0 0 1px rgba(39,245,154,.06), 0 30px 80px -20px rgba(0,0,0,.8), inset 0 0 40px rgba(39,245,154,.04);
  backdrop-filter: blur(10px); overflow: hidden;
}
.boot-bar-top { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: .05em; }
.boot-bar-top .dots { display: flex; gap: 6px; margin-right: 6px; }
.boot-bar-top .dots i { width: 10px; height: 10px; border-radius: 50%; display: block; }
.boot-bar-top .dots i:nth-child(1){ background:#ff5f57; } .boot-bar-top .dots i:nth-child(2){ background:#febc2e; } .boot-bar-top .dots i:nth-child(3){ background:#28c840; }
.boot-log { margin: 0; padding: 16px 18px; min-height: 230px; font-family: var(--mono); font-size: 12.5px; line-height: 1.75;
  color: #bfe9d4; white-space: pre-wrap; word-break: break-word; }
.boot-log .ln { opacity: 0; transform: translateY(4px); animation: lnIn .18s forwards; }
@keyframes lnIn { to { opacity: 1; transform: none; } }
.boot-log .tag-ok { color: var(--accent); text-shadow: 0 0 10px rgba(39,245,154,.5); }
.boot-log .tag-wait { color: var(--warn); }
.boot-log .dim { color: var(--faint); }
.boot-log .grant { color: #fff; font-weight: 700; letter-spacing: .14em; text-shadow: 0 0 16px rgba(39,245,154,.8); }
.boot-log .cursor { display: inline-block; width: 9px; height: 15px; background: var(--accent); vertical-align: -2px;
  box-shadow: 0 0 10px rgba(39,245,154,.7); animation: curBlink 1s steps(1) infinite; }
@keyframes curBlink { 50% { opacity: 0; } }
.boot-progress { width: 100%; }
.boot-track { height: 4px; border-radius: 4px; background: rgba(137,167,205,.14); overflow: hidden; }
.boot-fill { height: 100%; width: 0; border-radius: 4px; background: linear-gradient(90deg, var(--accent-2), var(--accent));
  box-shadow: 0 0 14px rgba(39,245,154,.7); transition: width .2s ease; }
.boot-meta { display: flex; justify-content: space-between; margin-top: 8px; font-family: var(--mono); font-size: 11px; color: var(--faint); }
.boot-hint { font-family: var(--mono); font-size: 11px; color: var(--faint); letter-spacing: .08em; }

/* ---- login ---- */
.login-wrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; animation: fadeIn .4s ease; }
.login-card {
  position: relative; background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-lg);
  padding: 40px 34px; width: 372px; display: flex; flex-direction: column; gap: 13px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.04); text-align: center; backdrop-filter: blur(16px);
}
.login-card::before { content: ""; position: absolute; inset: -1px; border-radius: inherit; padding: 1px; pointer-events: none;
  background: linear-gradient(140deg, rgba(39,245,154,.5), transparent 35%, transparent 65%, rgba(57,216,255,.45));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor; mask-composite: exclude; }
.login-card .logo { width: 66px; height: 66px; margin: 0 auto 6px; border-radius: 18px;
  display: grid; place-items: center; color: var(--accent-ink);
  background: linear-gradient(180deg, #4dffb0, var(--accent)); box-shadow: 0 10px 30px -8px rgba(39,245,154,.6), inset 0 1px 0 rgba(255,255,255,.4); }
.login-card h1 { margin: 0; font-size: 26px; font-weight: 800; font-family: var(--mono); letter-spacing: .08em; }
.login-card h1 span { color: var(--accent); text-shadow: 0 0 18px rgba(39,245,154,.5); }
.login-card p { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.login-card input {
  background: rgba(2,4,8,.6); border: 1px solid var(--line-2); border-radius: 11px;
  padding: 12px 14px; color: var(--fg); font-size: 14px; text-align: left; transition: border-color .15s, box-shadow .15s;
}
.login-card input::placeholder { color: var(--faint); }
.login-card input:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
.login-card .btn-primary { margin-top: 4px; padding: 12px; }
.err { color: var(--danger); font-size: 13px; min-height: 16px; }

/* ---- app layout ---- */
.app { display: flex; height: 100vh; animation: fadeIn .4s ease; }
.sidebar { width: 292px; min-width: 292px; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; backdrop-filter: blur(16px); }
.brand { display: flex; align-items: center; gap: 9px; padding: 17px 18px; font-weight: 800; font-size: 18px; font-family: var(--mono); letter-spacing: .08em; border-bottom: 1px solid var(--line); color: var(--fg); }
.brand .ic { color: var(--accent); filter: drop-shadow(0 0 6px rgba(39,245,154,.5)); }
.brand span { color: var(--accent); text-shadow: 0 0 14px rgba(39,245,154,.45); }
.search { display: flex; align-items: center; gap: 8px; margin: 13px; padding: 9px 12px; background: rgba(2,4,8,.5); border: 1px solid var(--line-2); border-radius: 11px; color: var(--faint); transition: border-color .15s, box-shadow .15s; }
.search:focus-within { border-color: var(--accent); color: var(--accent); box-shadow: var(--glow); }
.search input { flex: 1; background: none; border: none; color: var(--fg); font-size: 13px; outline: none; }
.search input::placeholder { color: var(--faint); }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px; color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; font-weight: 700; font-family: var(--mono); }
.side-head-btns { display: flex; gap: 2px; }

.server-list { list-style: none; margin: 0; padding: 6px 9px; overflow-y: auto; flex: 1; }
.server-list li { position: relative; display: flex; align-items: center; gap: 11px; padding: 11px 12px; border-radius: var(--radius); cursor: pointer; margin-bottom: 3px; border: 1px solid transparent; transition: background .12s, border-color .12s, transform .08s; }
.server-list li:hover { background: rgba(137,167,205,.06); border-color: var(--line); }
.server-list li:hover .actions { opacity: 1; }
.server-list li.active { background: linear-gradient(180deg, rgba(39,245,154,.1), rgba(39,245,154,.04)); border-color: rgba(39,245,154,.3); box-shadow: inset 0 0 0 1px rgba(39,245,154,.05); }
.server-list li.active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 3px; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--faint); flex: none; transition: background .2s, box-shadow .2s; }
.dot.online { background: var(--accent); box-shadow: 0 0 9px var(--accent); }
.dot.offline { background: var(--danger); box-shadow: 0 0 8px rgba(255,93,87,.6); }
.dot.checking { background: var(--warn); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .3; } }
.srv-main { flex: 1; min-width: 0; }
.srv-main .name { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.srv-main .notes { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-family: var(--mono); }
.actions { display: flex; gap: 1px; opacity: 0; transition: opacity .12s; flex: none; }
.actions .icon-btn { padding: 5px; }
.actions .icon-btn .ic { width: 15px; height: 15px; }
.empty-note { padding: 16px 10px; color: var(--muted); font-size: 12px; text-align: center; }

.side-foot { border-top: 1px solid var(--line); padding: 12px 15px; display: flex; align-items: center; justify-content: space-between; }
.who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 30px; height: 30px; border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); display: grid; place-items: center; color: #02130b; font-weight: 800; font-size: 13px; flex: none; box-shadow: 0 4px 14px -4px rgba(39,245,154,.6); }
.who .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- main / tabs ---- */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.tabs { display: flex; gap: 4px; background: rgba(5,8,13,.5); border-bottom: 1px solid var(--line); padding: 8px 10px 0; overflow-x: auto; min-height: 46px; }
.tabs::-webkit-scrollbar { height: 0; }
.tab { display: flex; align-items: center; gap: 8px; padding: 9px 13px; border-radius: 10px 10px 0 0; cursor: pointer; background: rgba(137,167,205,.05); color: var(--muted); white-space: nowrap; font-size: 13px; border: 1px solid transparent; border-bottom: none; transition: background .12s, color .12s; }
.tab:hover { color: var(--fg); background: rgba(137,167,205,.09); }
.tab.active { background: var(--bg); color: var(--fg); border-color: var(--line); box-shadow: 0 -2px 10px rgba(0,0,0,.3); }
.tab.active::after { content:""; position:absolute; } /* reserved */
.tab .ic { width: 15px; height: 15px; }
.tab .close { display: inline-flex; border: none; background: none; color: inherit; cursor: pointer; opacity: .5; padding: 1px; border-radius: 5px; }
.tab .close:hover { opacity: 1; color: var(--danger); background: rgba(255,93,87,.14); }
.tab .status { width: 7px; height: 7px; border-radius: 50%; background: var(--faint); flex: none; }
.tab.connected .status { background: var(--accent); box-shadow: 0 0 7px var(--accent); }
.tab.connecting .status { background: var(--warn); animation: pulse 1s infinite; }
.tab.dead .status { background: var(--danger); }

.panes { flex: 1; position: relative; background: var(--bg); overflow: hidden; }
.pane { position: absolute; inset: 0; display: none; }
.pane.active { display: flex; flex-direction: column; }
.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 20px; }
.empty .ic.xl { color: var(--faint); filter: drop-shadow(0 0 14px rgba(39,245,154,.2)); }
.empty .btn-primary { margin: 6px 0; }

/* ---- terminal ---- */
.term-wrap { display: flex; flex-direction: column; height: 100%; }
.term-toolbar { display: flex; align-items: center; gap: 9px; padding: 9px 13px; background: rgba(5,8,13,.6); border-bottom: 1px solid var(--line); }
.term-toolbar .t-title { font-size: 13px; font-weight: 650; font-family: var(--mono); }
.term-toolbar .t-stat { font-size: 11px; padding: 3px 10px; border-radius: 20px; background: rgba(137,167,205,.1); color: var(--muted); font-family: var(--mono); }
.term-toolbar .t-stat.connected { color: var(--accent); background: rgba(39,245,154,.12); box-shadow: inset 0 0 0 1px rgba(39,245,154,.25); }
.term-toolbar .t-stat.connecting { color: var(--warn); background: rgba(245,196,81,.12); }
.term-toolbar .t-stat.dead { color: var(--danger); background: rgba(255,93,87,.12); }
.term-toolbar .spacer { flex: 1; }
.term-host { flex: 1; padding: 8px 10px; min-height: 0; background:
  radial-gradient(1200px 400px at 50% -20%, rgba(39,245,154,.03), transparent 70%); }
.term-host .xterm { height: 100%; }

/* ---- file manager ---- */
.fm { display: flex; flex-direction: column; height: 100%; position: relative; }
.fm-bar { display: flex; align-items: center; gap: 6px; padding: 10px 13px; border-bottom: 1px solid var(--line); background: rgba(5,8,13,.6); }
.crumbs { flex: 1; display: flex; align-items: center; gap: 2px; font-family: var(--mono); font-size: 13px; overflow-x: auto; white-space: nowrap; }
.crumbs::-webkit-scrollbar { height: 0; }
.crumbs .seg { color: var(--accent-2); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.crumbs .seg:hover { background: rgba(57,216,255,.1); }
.crumbs .sep { color: var(--faint); }
.crumbs .seg.cur { color: var(--fg); cursor: default; }
.fm-list { flex: 1; overflow-y: auto; }
.fm-row { display: grid; grid-template-columns: 1fr 96px 150px 118px; align-items: center; gap: 10px; padding: 9px 15px; border-bottom: 1px solid rgba(137,167,205,.05); }
.fm-row.head { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; position: sticky; top: 0; background: var(--solid); z-index: 1; font-weight: 700; font-family: var(--mono); }
.fm-row:not(.head):hover { background: rgba(137,167,205,.06); }
.fm-row:not(.head):hover .r-act { opacity: 1; }
.fm-row .fname { display: flex; align-items: center; gap: 10px; min-width: 0; }
.fm-row .fname .ic { flex: none; color: var(--muted); }
.fm-row.dir .fname .ic { color: var(--accent-2); filter: drop-shadow(0 0 5px rgba(57,216,255,.4)); }
.fm-row .fname .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-row.dir .fname { cursor: pointer; }
.fm-row.dir .fname:hover .n { color: var(--accent-2); }
.fm-row .sz, .fm-row .mt { color: var(--muted); font-size: 12px; font-family: var(--mono); }
.fm-row .r-act { display: flex; gap: 1px; justify-content: flex-end; opacity: 0; transition: opacity .12s; }
.fm-row .r-act .icon-btn { padding: 4px; }
.fm-row .r-act .ic { width: 15px; height: 15px; }
.fm-empty, .fm-err { padding: 24px 14px; color: var(--muted); text-align: center; }
.fm-err { color: var(--danger); }
.fm-loading { padding: 24px; text-align: center; color: var(--muted); }
.drop-overlay { position: absolute; inset: 0; background: rgba(39,245,154,.08); border: 2px dashed var(--accent); border-radius: 12px; margin: 8px; display: none; align-items: center; justify-content: center; font-weight: 650; color: var(--accent); z-index: 5; pointer-events: none; }
.fm.dragging .drop-overlay { display: flex; }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; background: rgba(2,4,8,.6); backdrop-filter: blur(5px); display: flex; align-items: center; justify-content: center; z-index: 500; animation: fadeIn .14s; }
@keyframes fadeIn { from { opacity: 0; } }
.modal-card { position: relative; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--radius-lg); padding: 24px; width: 470px; max-width: calc(100vw - 32px); box-shadow: var(--shadow); backdrop-filter: blur(18px); animation: popIn .16s cubic-bezier(.2,.9,.3,1); }
.modal-card.sm { width: 410px; }
.modal-card.lg { width: min(920px, calc(100vw - 48px)); display: flex; flex-direction: column; max-height: calc(100vh - 64px); }
@keyframes popIn { from { transform: translateY(10px) scale(.98); opacity: 0; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.modal-head h2 { margin: 0; font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.modal-head h2 .ic { color: var(--accent); }
.modal-card label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
.modal-card input[type=text], .modal-card input[type=password] { width: 100%; margin-top: 7px; background: rgba(2,4,8,.6); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 13px; color: var(--fg); font-size: 14px; transition: border-color .15s, box-shadow .15s; }
.modal-card input:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
.modal-card .row { display: flex; gap: 7px; margin-top: 6px; }
.modal-card .row input { margin-top: 0; }
.modal-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 8px; }
.modal-actions .muted { margin-right: auto; }
.dlg-msg { color: var(--muted); margin: 0 0 18px; white-space: pre-wrap; }
#dlgInput { width: 100%; margin-bottom: 18px; background: rgba(2,4,8,.6); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 13px; color: var(--fg); font-size: 14px; }
#dlgInput:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
.warn-note { background: rgba(245,196,81,.1); border: 1px solid rgba(245,196,81,.3); color: var(--warn); padding: 10px 13px; border-radius: 10px; font-size: 12px; margin-bottom: 12px; line-height: 1.55; }
.warn-note b { color: #ffe39a; }
#edArea { flex: 1; width: 100%; min-height: 300px; background: rgba(2,4,8,.7); border: 1px solid var(--line-2); border-radius: 10px; padding: 13px; color: var(--fg); font-family: var(--mono); font-size: 13px; line-height: 1.55; resize: none; tab-size: 4; margin-bottom: 14px; }
#edArea:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(137,167,205,.18); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(39,245,154,.3); background-clip: padding-box; }

/* ---- account key / onboard / users ---- */
.foot-btns { display: flex; gap: 2px; }
.role-badge { display: inline-block; font-size: 10px; padding: 1px 7px; border-radius: 20px; background: rgba(137,167,205,.12); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-left: 6px; vertical-align: 1px; font-family: var(--mono); font-weight: 700; }
.role-badge.admin { background: rgba(57,216,255,.16); color: var(--accent-2); box-shadow: inset 0 0 0 1px rgba(57,216,255,.25); }
.who > span { display: flex; align-items: center; }

.cmd-box { display: flex; align-items: center; gap: 8px; background: rgba(2,4,8,.7); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 13px; margin: 7px 0 0; }
.cmd-box code { background: none; padding: 0; flex: 1; font-size: 12.5px; color: var(--accent); word-break: break-all; line-height: 1.55; text-shadow: 0 0 10px rgba(39,245,154,.3); }
.key-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(2,4,8,.7); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 13px; margin-top: 14px; }
.keyval { background: none; padding: 0; color: var(--fg); font-size: 13px; word-break: break-all; }

.users-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 14px; max-height: 320px; overflow-y: auto; }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; background: rgba(2,4,8,.5); border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 13px; }
.user-row code { font-size: 11px; }
.user-acts { display: flex; gap: 2px; flex: none; }
.user-add { display: flex; gap: 7px; }
.user-add input { flex: 1; background: rgba(2,4,8,.6); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; color: var(--fg); font-size: 13px; }
.user-add input:focus { outline: none; border-color: var(--accent); box-shadow: var(--glow); }
.user-add select { background: var(--solid); border: 1px solid var(--line-2); border-radius: 10px; color: var(--fg); padding: 0 10px; font-size: 13px; cursor: pointer; }
.user-add .btn-primary { padding: 10px 15px; }

/* command logs (per-server tab) */
.logs-pane { display: flex; flex-direction: column; height: 100%; padding: 20px 24px; overflow: hidden; }
.logs-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.logs-header h3 { display: flex; align-items: center; gap: 8px; font-size: 1rem; font-weight: 600; color: var(--fg); margin: 0; }
.logs-toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.logs-search { position: relative; flex: 1; min-width: 180px; }
.logs-search .ic { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.logs-search input { width: 100%; padding: 8px 10px 8px 32px; background: var(--card); border: 1px solid var(--border); border-radius: 6px; color: var(--fg); font-size: .85rem; }
.logs-table { flex: 1; overflow-y: auto; font-family: var(--mono); font-size: .8rem; border: 1px solid var(--border); border-radius: 8px; background: rgba(0,0,0,.3); }
.logs-table::-webkit-scrollbar { width: 6px; } .logs-table::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
.log-head-row { display: grid; grid-template-columns: 160px 90px 1fr; padding: 8px 14px; border-bottom: 1px solid var(--border); font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; position: sticky; top: 0; background: var(--card); z-index: 1; }
.log-row { display: grid; grid-template-columns: 160px 90px 1fr; padding: 7px 14px; border-bottom: 1px solid var(--border); gap: 8px; align-items: baseline; transition: background .15s; }
.log-row:hover { background: rgba(39,245,154,.06); }
.log-row .log-time { color: var(--muted); font-size: .75rem; white-space: nowrap; }
.log-row .log-user { color: var(--accent-2); font-size: .78rem; }
.log-row .log-cmd { color: var(--accent); word-break: break-all; }
.log-empty { padding: 60px 20px; text-align: center; color: var(--muted); }
.logs-foot { padding: 10px 0; text-align: center; }
.log-row.risk-critical { background: rgba(220,38,38,.13); border-left: 3px solid #dc2626; }
.log-row.risk-high { background: rgba(239,68,68,.09); border-left: 3px solid #ef4444; }
.log-row.risk-med { background: rgba(234,179,8,.08); border-left: 3px solid #ca8a04; }
.log-filter-bar { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.log-filter-btn { padding: 3px 9px; font-size: .68rem; border-radius: 20px; border: 1px solid var(--border); background: transparent; color: var(--muted); cursor: pointer; transition: all .15s; }
.log-filter-btn.active, .log-filter-btn:hover { background: var(--accent); color: #000; border-color: var(--accent); }
.et { display: inline-block; font-size: .6rem; font-weight: 700; border-radius: 3px; padding: 1px 4px; margin-right: 5px; vertical-align: middle; letter-spacing: .3px; }
.et.fim { background: rgba(167,139,250,.25); color: #a78bfa; }
.et.auth { background: rgba(251,191,36,.25); color: #fbbf24; }
.et.net { background: rgba(56,189,248,.25); color: #38bdf8; }
.et.ssh { background: rgba(74,222,128,.2); color: #4ade80; }
.log-sessions-panel { max-height: 200px; overflow-y: auto; border: 1px solid var(--border); border-radius: 8px; background: rgba(0,0,0,.3); margin-bottom: 10px; font-family: var(--mono); font-size: .8rem; }
.session-row { display: grid; grid-template-columns: 160px 90px 1fr; padding: 6px 14px; border-bottom: 1px solid var(--border); gap: 8px; align-items: center; }
.session-row:last-child { border-bottom: none; }
.btn-xs { padding: 3px 8px !important; font-size: .7rem !important; }
.replay-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.85); z-index: 9999; display: flex; align-items: center; justify-content: center; }
.replay-modal { background: var(--card); border: 1px solid var(--border); border-radius: 10px; width: 92vw; max-width: 1200px; height: 88vh; display: flex; flex-direction: column; overflow: hidden; }
.replay-hdr { display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; border-bottom: 1px solid var(--border); gap: 10px; }
.replay-title { font-weight: 600; font-size: .88rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.replay-status { padding: 3px 16px; font-size: .72rem; color: var(--muted); background: rgba(0,0,0,.2); font-family: var(--mono); }
.replay-term-host { flex: 1; overflow: hidden; padding: 8px; background: #020408; min-height: 0; }
.replay-spd { background: var(--card); border: 1px solid var(--border); color: var(--fg); border-radius: 4px; padding: 2px 4px; font-size: .78rem; cursor: pointer; }

/* ---- analytics & overview ---- */
.analytics-pane { display: flex; flex-direction: column; height: 100%; padding: 20px 24px; overflow: hidden; gap: 0; }
.an-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.an-header h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.an-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; overflow-y: auto; padding-bottom: 16px; }
.an-card { background: rgba(0,0,0,.35); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.an-card-wide { grid-column: span 2; }
.an-card-title { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 10px; }

/* heatmap */
.hm-wrap { overflow-x: auto; }
.hm-row { display: flex; align-items: center; gap: 2px; margin-bottom: 2px; }
.hm-corner, .hm-day { width: 32px; flex: none; font-size: .65rem; color: var(--muted); text-align: right; padding-right: 4px; }
.hm-h { width: 18px; flex: none; font-size: .58rem; color: var(--muted); text-align: center; }
.hm-cell { width: 18px; height: 14px; border-radius: 2px; flex: none; cursor: default; transition: opacity .1s; }
.hm-cell:hover { opacity: .7; }
.hm-cell.lv0 { background: rgba(137,167,205,.1); }
.hm-cell.lv1 { background: rgba(39,245,154,.2); }
.hm-cell.lv2 { background: rgba(39,245,154,.4); }
.hm-cell.lv3 { background: rgba(39,245,154,.65); }
.hm-cell.lv4 { background: rgba(39,245,154,.9); }

/* bar chart */
.bc-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .78rem; }
.bc-label { width: 140px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--fg); font-family: var(--mono); font-size: .72rem; }
.bc-bar { flex: 1; background: rgba(137,167,205,.12); border-radius: 3px; height: 10px; min-width: 60px; overflow: hidden; }
.bc-fill { height: 100%; background: var(--accent); border-radius: 3px; min-width: 2px; transition: width .4s; }
.bc-fill.auth { background: #fbbf24; }
.bc-fill.fim { background: #a78bfa; }
.bc-fill.net { background: #38bdf8; }
.bc-fill.ssh { background: #4ade80; }
.bc-val { width: 36px; text-align: right; color: var(--muted); font-family: var(--mono); font-size: .7rem; flex: none; }

/* daily chart */
.daily-chart { display: flex; align-items: flex-end; gap: 2px; height: 64px; overflow-x: auto; padding: 4px 0; }
.daily-bar { min-width: 6px; flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; opacity: .75; transition: opacity .15s; cursor: default; }
.daily-bar:hover { opacity: 1; }
.daily-labels { display: flex; justify-content: space-between; font-size: .65rem; color: var(--muted); margin-top: 2px; }

/* overview cards */
.overview-pane { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; overflow-y: auto; padding-bottom: 16px; }
.srv-card { background: rgba(0,0,0,.35); border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.srv-card-name { font-weight: 700; font-size: .9rem; margin-bottom: 10px; color: var(--accent-2); }
.srv-card-health {}
.health-bar-row { display: flex; align-items: center; gap: 6px; margin-bottom: 5px; font-size: .72rem; }
.hb-lbl { width: 32px; flex: none; color: var(--muted); font-family: var(--mono); }
.health-bar { flex: 1; height: 6px; background: rgba(137,167,205,.12); border-radius: 3px; overflow: hidden; }
.health-fill { height: 100%; background: var(--accent); border-radius: 3px; min-width: 2px; }
.hb-val { width: 36px; text-align: right; color: var(--muted); font-family: var(--mono); font-size: .68rem; flex: none; }
.hb-up { font-size: .68rem; color: var(--muted); margin-top: 4px; font-family: var(--mono); }
.hf-warn { background: #ef4444 !important; }
.srv-card-meta { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.sm-chip { display: inline-block; font-size: .68rem; padding: 2px 7px; border-radius: 20px; background: rgba(137,167,205,.12); color: var(--muted); border: 1px solid rgba(137,167,205,.18); white-space: nowrap; }
.chip-docker { background: rgba(57,189,255,.15); color: #38bdf8; border-color: rgba(57,189,255,.3); }
.chip-root { background: rgba(39,245,154,.15); color: var(--accent); border-color: rgba(39,245,154,.3); }

/* threat section */
.threat-row { display: flex; align-items: center; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: .75rem; }
.threat-row:last-child { border-bottom: none; }
.threat-cnt { flex: none; font-weight: 700; color: var(--danger); min-width: 32px; }
.threat-srv { flex: none; color: var(--accent-2); min-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* threat toast */
.threat-toast { max-width: 380px; }
.tt-head { font-weight: 700; font-size: .82rem; margin-bottom: 4px; }
.tt-cmd { font-family: var(--mono); font-size: .72rem; color: rgba(255,255,255,.7); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* geo tag */
.geo-tag { display: inline-block; font-size: .65rem; padding: 1px 5px; background: rgba(57,216,255,.12); color: var(--accent-2); border-radius: 3px; margin-left: 6px; vertical-align: middle; font-family: var(--mono); letter-spacing: .2px; cursor: default; }

/* sidebar health line */
.srv-health { display: flex; gap: 8px; font-size: .65rem; color: var(--muted); margin-top: 2px; font-family: var(--mono); }
.srv-health span { white-space: nowrap; }

/* responsive */
@media (max-width: 720px) {
  .sidebar { width: 230px; min-width: 230px; }
  .fm-row { grid-template-columns: 1fr 70px 70px; }
  .fm-row .mt { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .glitch::before, .glitch::after, .boot-log .cursor { animation: none; }
}
