@import url('https://fonts.googleapis.com/css2?family=Instrument+Serif:ital@0;1&family=JetBrains+Mono:wght@300;400;500;600&family=Inter:wght@300;400;500;600&display=swap');

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg:     #060608;
  --bg1:    #0c0c0f;
  --bg2:    #131318;
  --bg3:    #1a1a22;
  --bg4:    #22222c;
  --bg5:    #2c2c38;
  --line:   #1c1c24;
  --line2:  #28283a;
  --line3:  #363650;
  --t0:     #efefef;
  --t1:     #888898;
  --t2:     #484858;
  --t3:     #2c2c3a;
  --ac:     #c8b8e8;
  --ac2:    #a890d0;
  --ac3:    #7860a8;
  --ac4:    #3c2870;
  --gold:   #c8a86a;
  --gold2:  #a88848;
  --red:    #d04040;
  --red2:   #f05050;
  --grn:    #38b870;
  --grn2:   #50d888;
  --amber:  #d07828;
  --mono:   'JetBrains Mono', monospace;
  --serif:  'Instrument Serif', serif;
  --sans:   'Inter', sans-serif;
  --r:      4px;
  --r2:     6px;
  --r3:     10px;
  --r4:     14px;
  --glow:   0 0 20px rgba(168,144,208,.12);
  --glow2:  0 0 40px rgba(168,144,208,.08);
  --shadow: 0 8px 32px rgba(0,0,0,.6);
  --shadow2:0 20px 60px rgba(0,0,0,.8);
  --shadow3:0 2px 8px rgba(0,0,0,.4);
}

html { background: var(--bg); }
body { font-family: var(--sans); background: var(--bg); color: var(--t1); min-height: 100vh; -webkit-font-smoothing: antialiased; overflow-x: hidden; }

::-webkit-scrollbar { width: 3px; height: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg4); border-radius: 2px; }
::-webkit-scrollbar-thumb:hover { background: var(--line3); }

/* ══ LOGIN ═══════════════════════════════════════════════════════════════════ */

.login-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

/* Radial ambient glow behind the card */
.login-wrap::after {
  content: '';
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: 600px; height: 600px;
  background: radial-gradient(ellipse, rgba(120,96,168,.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.login-grid { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.login-grid canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }

.login-card {
  width: 100%;
  max-width: 400px;
  position: relative;
  z-index: 1;
  padding: 0 32px;
}

/* Staggered entrance */
.login-card > * {
  opacity: 0;
  transform: translateY(22px);
  animation: riseIn .65s cubic-bezier(.16,1,.3,1) forwards;
}
.login-card > *:nth-child(1) { animation-delay: .04s; }
.login-card > *:nth-child(2) { animation-delay: .10s; }
.login-card > *:nth-child(3) { animation-delay: .16s; }
.login-card > *:nth-child(4) { animation-delay: .22s; }
.login-card > *:nth-child(5) { animation-delay: .28s; }
.login-card > *:nth-child(6) { animation-delay: .34s; }
.login-card > *:nth-child(7) { animation-delay: .40s; }
.login-card > *:nth-child(8) { animation-delay: .46s; }
.login-card > *:nth-child(9) { animation-delay: .52s; }
@keyframes riseIn { to { opacity: 1; transform: translateY(0); } }

.login-eyebrow {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 5px;
  color: var(--t2);
  text-transform: uppercase;
  margin-bottom: 44px;
  display: flex;
  align-items: center;
  gap: 16px;
}
.login-eyebrow::before {
  content: '';
  display: block;
  width: 24px; height: 1px;
  background: linear-gradient(90deg, var(--ac3), transparent);
  flex-shrink: 0;
}

.login-h {
  font-family: var(--serif);
  font-size: 58px;
  font-weight: 400;
  color: var(--t0);
  margin-bottom: 12px;
  line-height: 1.0;
  letter-spacing: -.5px;
}
.login-h b {
  font-style: italic;
  font-weight: 400;
  color: var(--ac);
}

.login-sub {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t2);
  margin-bottom: 44px;
  letter-spacing: 1.5px;
}

.field { margin-bottom: 14px; }
.field-label {
  font-family: var(--mono);
  font-size: 8px;
  font-weight: 500;
  letter-spacing: 3px;
  color: var(--t2);
  text-transform: uppercase;
  display: block;
  margin-bottom: 8px;
}
.field-input {
  width: 100%;
  padding: 13px 16px;
  background: var(--bg1);
  border: 1px solid var(--line2);
  color: var(--t0);
  font-size: 14px;
  font-family: var(--sans);
  font-weight: 400;
  outline: none;
  border-radius: var(--r2);
  transition: border-color .18s, box-shadow .18s, background .18s;
  letter-spacing: .1px;
}
.field-input::placeholder { color: var(--t3); }
.field-input:focus {
  border-color: var(--ac3);
  background: var(--bg2);
  box-shadow: 0 0 0 3px rgba(120,96,168,.1), var(--glow);
}

/* captcha */
.captcha {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  background: var(--bg1);
  border: 1px solid var(--line2);
  border-radius: var(--r2);
  margin-bottom: 14px;
  cursor: pointer;
  user-select: none;
  transition: border-color .18s, background .18s;
}
.captcha:hover { border-color: var(--line3); background: var(--bg2); }
.captcha.done { border-color: rgba(80,216,136,.25); background: rgba(80,216,136,.03); }
.captcha-left { display: flex; align-items: center; gap: 13px; }
.captcha-box {
  width: 20px; height: 20px;
  border: 1.5px solid var(--line3);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  transition: all .2s;
  flex-shrink: 0;
}
.captcha.loading .captcha-box { border-color: var(--ac2); }
.captcha.done .captcha-box { border-color: var(--grn2); background: var(--grn2); }
.captcha-spinner { width: 10px; height: 10px; border: 1.5px solid transparent; border-top-color: var(--ac2); border-radius: 50%; animation: spin .6s linear infinite; display: none; }
.captcha.loading .captcha-spinner { display: block; }
.captcha-checkmark { display: none; }
.captcha.done .captcha-checkmark { display: flex; align-items: center; justify-content: center; }
.captcha-checkmark svg { width: 11px; height: 11px; stroke: var(--bg); fill: none; stroke-width: 2.5; }
.captcha-label { font-size: 12px; color: var(--t1); font-family: var(--sans); font-weight: 400; }
.captcha.done .captcha-label { color: var(--grn2); }
.captcha-brand { font-family: var(--mono); font-size: 7px; color: var(--t3); text-align: right; line-height: 1.8; letter-spacing: .5px; }

/* error / success */
.login-err {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--red2);
  padding: 10px 14px;
  background: rgba(208,64,64,.06);
  border: 1px solid rgba(208,64,64,.18);
  border-radius: var(--r2);
  margin-bottom: 14px;
  display: none;
  align-items: center;
  gap: 8px;
  letter-spacing: .5px;
}

/* Primary button */
.login-btn {
  width: 100%;
  padding: 14px;
  background: var(--t0);
  border: none;
  color: var(--bg);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--mono);
  letter-spacing: 4px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--r2);
  margin-top: 4px;
  transition: background .18s, transform .12s, box-shadow .18s;
  box-shadow: 0 2px 16px rgba(239,239,239,.06);
}
.login-btn:hover:not(:disabled) {
  background: var(--ac);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(200,184,232,.18);
}
.login-btn:active:not(:disabled) { transform: translateY(0); }
.login-btn:disabled { opacity: .2; cursor: not-allowed; }

.login-footer {
  margin-top: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.login-about {
  font-family: var(--mono);
  font-size: 9px;
  color: var(--t2);
  cursor: pointer;
  letter-spacing: 1px;
  background: none;
  border: none;
  padding: 0;
  transition: color .15s;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--t3);
}
.login-about:hover { color: var(--ac); text-decoration-color: var(--ac3); }

/* ══ APP SHELL ═══════════════════════════════════════════════════════════════ */
.app { display: none; height: 100vh; flex-direction: column; overflow: hidden; }
.app.visible { display: flex; }

/* topbar */
.topbar {
  height: 50px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 8px;
  flex-shrink: 0;
  z-index: 50;
}

.logo {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 4px;
  color: var(--t2);
  text-transform: uppercase;
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 11px;
}
.logo-mark {
  width: 24px; height: 24px;
  background: var(--t0);
  border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 0 12px rgba(239,239,239,.08);
}
.logo-mark span { font-size: 8px; font-family: var(--mono); font-weight: 700; color: var(--bg); line-height: 1; letter-spacing: 0; }
.logo b { color: var(--t0); font-weight: 600; }

.node-pill {
  display: flex; align-items: center;
  background: var(--bg1);
  border: 1px solid var(--line2);
  border-radius: var(--r2);
  overflow: hidden;
  height: 32px;
  transition: border-color .15s;
}
.node-pill:hover { border-color: var(--line3); }
.node-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  margin-left: 12px;
  flex-shrink: 0;
  transition: background .4s, box-shadow .4s;
}
.node-dot.online { background: var(--grn2); box-shadow: 0 0 8px rgba(80,216,136,.5); }
.node-dot.offline { background: var(--t3); }
.node-pill select { padding: 0 8px 0 8px; background: transparent; border: none; color: var(--t1); font-size: 10px; font-family: var(--mono); outline: none; cursor: pointer; min-width: 140px; height: 100%; }
.node-pill select option { background: var(--bg2); }
.node-sw { padding: 0 13px; height: 100%; background: var(--bg2); border: none; border-left: 1px solid var(--line2); color: var(--t2); font-size: 8px; font-family: var(--mono); letter-spacing: 2px; text-transform: uppercase; cursor: pointer; transition: all .13s; }
.node-sw:hover { color: var(--t0); background: var(--bg3); }

.tbtn {
  height: 32px; padding: 0 14px;
  background: transparent;
  border: 1px solid var(--line2);
  color: var(--t2);
  font-size: 9px;
  font-family: var(--mono);
  letter-spacing: 1px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--r2);
  transition: all .13s;
}
.tbtn:hover { border-color: var(--line3); color: var(--t0); background: var(--bg1); }
.tbtn.hi { color: var(--ac); border-color: rgba(168,144,208,.3); }
.tbtn.hi:hover { background: rgba(168,144,208,.06); border-color: var(--ac3); box-shadow: var(--glow); }

.uchip {
  display: flex; align-items: center;
  gap: 8px;
  padding: 3px 12px 3px 3px;
  background: var(--bg1);
  border: 1px solid var(--line2);
  border-radius: 28px;
  transition: border-color .13s;
  cursor: default;
}
.uchip:hover { border-color: var(--line3); }
.uav {
  width: 26px; height: 26px;
  background: var(--bg3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700;
  color: var(--ac); font-family: var(--mono);
  border: 1px solid var(--line3);
  flex-shrink: 0;
}
.uname { font-family: var(--mono); font-size: 9px; color: var(--t1); }

/* ══ BODY ════════════════════════════════════════════════════════════════════ */
.body { display: flex; flex: 1; overflow: hidden; }

/* ══ SIDEBAR ════════════════════════════════════════════════════════════════ */
.sidebar {
  width: 200px;
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 10px 0;
}
.sb-sect { padding: 18px 12px 6px; }
.sb-lbl {
  font-family: var(--mono);
  font-size: 7px; font-weight: 600;
  letter-spacing: 3px;
  color: var(--t3);
  text-transform: uppercase;
  padding: 0 10px;
  margin-bottom: 4px;
  display: block;
}
.sb-item {
  display: flex; align-items: center;
  gap: 9px; padding: 8px 10px;
  border-radius: var(--r2);
  cursor: pointer;
  color: var(--t2);
  font-size: 12px; font-weight: 400;
  transition: all .12s;
  user-select: none;
  border: 1px solid transparent;
  margin: 1px 2px;
  letter-spacing: .1px;
}
.sb-item:hover { background: var(--bg2); color: var(--t1); border-color: var(--line); }
.sb-item.active { background: var(--bg2); color: var(--t0); border-color: var(--line2); }
.sb-item svg { width: 13px; height: 13px; flex-shrink: 0; opacity: .3; stroke-width: 1.5; transition: opacity .12s; }
.sb-item.active svg { opacity: .65; color: var(--ac); }
.sb-item:hover svg { opacity: .5; }
.sb-item.active { position: relative; }
.sb-item.active::before {
  content: '';
  position: absolute; left: 0; top: 20%; bottom: 20%;
  width: 2px;
  background: var(--ac3);
  border-radius: 2px;
}
.sb-divider { height: 1px; background: var(--line); margin: 8px 14px; }

/* ══ MAIN ════════════════════════════════════════════════════════════════════ */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; background: var(--bg); }

.action-bar {
  padding: 8px 20px;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center;
  gap: 3px; flex-shrink: 0;
  background: var(--bg);
}
.abar-btn {
  height: 28px;
  display: inline-flex; align-items: center;
  gap: 5px; padding: 0 11px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--t2);
  font-size: 9px;
  font-family: var(--mono);
  letter-spacing: .8px;
  text-transform: uppercase;
  cursor: pointer;
  border-radius: var(--r);
  transition: all .11s;
  white-space: nowrap;
}
.abar-btn:hover { background: var(--bg2); border-color: var(--line2); color: var(--t0); }
.abar-btn.primary { background: var(--t0); border-color: var(--t0); color: var(--bg); font-weight: 600; }
.abar-btn.primary:hover { background: var(--ac); border-color: var(--ac); box-shadow: 0 2px 12px rgba(200,184,232,.15); }
.abar-btn.danger { color: var(--red2); }
.abar-btn.danger:hover { border-color: rgba(208,64,64,.2); background: rgba(208,64,64,.05); }
.abar-sep { width: 1px; height: 14px; background: var(--line2); margin: 0 4px; flex-shrink: 0; }
.abar-spacer { flex: 1; }

.search-wrap { position: relative; display: flex; align-items: center; }
.search-wrap svg { position: absolute; left: 9px; color: var(--t3); pointer-events: none; }
.search-input {
  height: 28px; padding: 0 10px 0 28px;
  background: var(--bg1); border: 1px solid var(--line2);
  color: var(--t0); font-size: 10px; font-family: var(--mono);
  outline: none; border-radius: var(--r);
  width: 155px; transition: all .16s; letter-spacing: .3px;
}
.search-input::placeholder { color: var(--t3); }
.search-input:focus { border-color: var(--line3); width: 200px; box-shadow: 0 0 0 2px rgba(120,96,168,.08); }

.view-toggle { display: flex; background: var(--bg1); border: 1px solid var(--line2); border-radius: var(--r); overflow: hidden; }
.vt-btn { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border: none; background: transparent; cursor: pointer; color: var(--t2); transition: all .1s; }
.vt-btn:hover { color: var(--t1); }
.vt-btn.active { background: var(--bg3); color: var(--t0); }

.breadcrumb {
  display: flex; align-items: center; gap: 6px;
  padding: 0 20px; height: 32px;
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 10px; color: var(--t3);
  flex-shrink: 0;
  background: var(--bg1);
  position: relative;
}
.bc-back {
  width: 20px; height: 20px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line2);
  border-radius: 3px; cursor: pointer;
  color: var(--t2); font-size: 10px;
  transition: all .11s; flex-shrink: 0;
}
.bc-back:hover { border-color: var(--line3); color: var(--t0); background: var(--bg2); }
.bc-sep { color: var(--t3); }
.bc-seg { color: var(--t2); }

/* ══ FILES ═══════════════════════════════════════════════════════════════════ */
.file-area { flex: 1; overflow-y: auto; padding: 18px 20px; background: var(--bg); }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 5px; }
.file-list { display: flex; flex-direction: column; gap: 1px; }

/* Grid card */
.fc {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--r3);
  padding: 16px 10px 44px;
  cursor: pointer;
  transition: border-color .13s, background .13s, box-shadow .13s, transform .12s;
  text-align: center; position: relative;
  user-select: none; overflow: hidden;
}
.fc:hover {
  border-color: var(--line3);
  background: var(--bg2);
  box-shadow: 0 4px 16px rgba(0,0,0,.4);
  transform: translateY(-2px);
}
.fc.selected {
  border-color: var(--ac3);
  background: rgba(120,96,168,.06);
  box-shadow: 0 0 0 1px rgba(120,96,168,.12) inset;
}
.fc-check {
  position: absolute; top: 8px; left: 8px;
  width: 15px; height: 15px;
  border: 1px solid var(--line3);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  transition: all .12s; background: var(--bg2);
}
.fc.selected .fc-check { border-color: var(--ac2); background: var(--ac2); }
.fc-check-mark { display: none; }
.fc.selected .fc-check-mark { display: block; }
.fc-check-mark svg { width: 8px; height: 8px; color: var(--bg); }
.fc-icon {
  width: 38px; height: 38px;
  margin: 2px auto 12px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r2);
  background: var(--bg2);
  border: 1px solid var(--line2);
  transition: all .13s;
}
.fc-icon svg { width: 16px; height: 16px; color: var(--t2); }
.fc.folder .fc-icon { background: rgba(168,144,208,.08); border-color: rgba(168,144,208,.18); }
.fc.folder .fc-icon svg { color: var(--ac2); }
.fc:hover .fc-icon { border-color: var(--line3); }
.fc.selected .fc-icon { background: rgba(168,144,208,.12); border-color: rgba(168,144,208,.25); }
.fc.selected .fc-icon svg { color: var(--ac); }
.fc-name { font-size: 10px; font-weight: 500; color: var(--t1); word-break: break-all; line-height: 1.4; margin-bottom: 2px; }
.fc-meta { font-family: var(--mono); font-size: 8px; color: var(--t3); }
.fc-actions { position: absolute; bottom: 0; left: 0; right: 0; background: var(--bg2); border-top: 1px solid var(--line2); border-radius: 0 0 var(--r3) var(--r3); padding: 5px; gap: 2px; display: none; justify-content: center; flex-wrap: wrap; }
.fc.selected .fc-actions, .fc:hover .fc-actions { display: flex; }
.fa-btn { height: 20px; padding: 0 7px; background: transparent; border: none; color: var(--t2); font-size: 8px; font-family: var(--mono); cursor: pointer; border-radius: 3px; transition: all .1s; white-space: nowrap; letter-spacing: .5px; }
.fa-btn:hover { background: var(--bg3); color: var(--t0); }
.fa-btn.red { color: var(--red2); }
.fa-btn.red:hover { background: rgba(208,64,64,.1); }

/* List row */
.fl { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: var(--r2); cursor: pointer; transition: background .08s; user-select: none; }
.fl:hover { background: var(--bg1); }
.fl.selected { background: rgba(120,96,168,.05); outline: 1px solid rgba(120,96,168,.1); }
.fl-check { width: 14px; height: 14px; border: 1px solid var(--line2); border-radius: 3px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: all .1s; }
.fl.selected .fl-check { background: var(--ac2); border-color: var(--ac2); }
.fl-icon { width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r); }
.fl-icon svg { width: 11px; height: 11px; color: var(--t2); }
.fl.folder .fl-icon { background: rgba(168,144,208,.06); border-color: rgba(168,144,208,.12); }
.fl.folder .fl-icon svg { color: var(--ac2); }
.fl-name { font-size: 12px; font-weight: 400; color: var(--t1); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fl-size { font-family: var(--mono); font-size: 9px; color: var(--t2); width: 64px; text-align: right; flex-shrink: 0; }
.fl-date { font-family: var(--mono); font-size: 9px; color: var(--t2); width: 84px; text-align: right; flex-shrink: 0; }
.fl-actions { display: none; align-items: center; gap: 3px; flex-shrink: 0; }
.fl:hover .fl-actions, .fl.selected .fl-actions { display: flex; }
.fla-btn { height: 22px; padding: 0 8px; background: var(--bg2); border: 1px solid var(--line2); color: var(--t2); font-size: 8px; font-family: var(--mono); cursor: pointer; border-radius: var(--r); transition: all .1s; white-space: nowrap; letter-spacing: .5px; }
.fla-btn:hover { background: var(--bg3); color: var(--t0); border-color: var(--line3); }
.fla-btn.red { color: var(--red2); border-color: transparent; }
.fla-btn.red:hover { background: rgba(208,64,64,.07); }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 300px; gap: 14px; color: var(--t3); grid-column: 1/-1; }
.empty-state svg { width: 32px; height: 32px; opacity: .12; }
.empty-state p { font-size: 12px; font-weight: 400; color: var(--t2); }
.empty-state small { font-family: var(--mono); font-size: 9px; color: var(--t3); }

/* ══ STATUS PAGE ════════════════════════════════════════════════════════════ */
.status-page { display: none; flex: 1; overflow-y: auto; padding: 30px; background: var(--bg); }
.status-page.visible { display: block; }
.pg-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 30px; padding-bottom: 22px; border-bottom: 1px solid var(--line); }
.pg-title { font-size: 22px; font-weight: 300; color: var(--t0); letter-spacing: -.5px; margin-bottom: 5px; }
.pg-sub { font-family: var(--mono); font-size: 9px; color: var(--t3); letter-spacing: 1.5px; }
.pg-action { height: 30px; padding: 0 14px; background: transparent; border: 1px solid var(--line2); color: var(--t2); font-size: 8px; font-family: var(--mono); letter-spacing: 2px; text-transform: uppercase; cursor: pointer; border-radius: var(--r2); transition: all .13s; }
.pg-action:hover { border-color: var(--line3); color: var(--t0); background: var(--bg1); }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; margin-bottom: 30px; }
.stat-card {
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--r3);
  padding: 22px 18px;
  transition: border-color .13s, transform .12s, box-shadow .13s;
  position: relative; overflow: hidden;
}
.stat-card:hover { border-color: var(--line2); transform: translateY(-2px); box-shadow: var(--shadow3); }
.stat-card::before { content: ''; position: absolute; top: 0; left: 0; width: 2px; height: 100%; background: var(--line2); border-radius: var(--r3) 0 0 var(--r3); }
.stat-card.col-grn::before { background: var(--grn2); box-shadow: 0 0 8px var(--grn); }
.stat-card.col-amber::before { background: var(--amber); }
.stat-card.col-ac::before { background: var(--ac2); box-shadow: 0 0 8px var(--ac4); }
.stat-tag { font-family: var(--mono); font-size: 7px; font-weight: 600; letter-spacing: 2.5px; text-transform: uppercase; color: var(--t2); margin-bottom: 16px; display: block; }
.stat-val { font-family: var(--mono); font-size: 28px; color: var(--t0); line-height: 1; margin-bottom: 4px; font-weight: 300; letter-spacing: -1.5px; }
.stat-sub { font-family: var(--mono); font-size: 9px; color: var(--t2); }

.sect-lbl { font-family: var(--mono); font-size: 7px; font-weight: 600; letter-spacing: 3px; text-transform: uppercase; color: var(--t2); margin-bottom: 12px; padding-bottom: 10px; border-bottom: 1px solid var(--line); display: block; }

.node-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 6px; margin-bottom: 30px; }
.node-card { background: var(--bg1); border: 1px solid var(--line); border-radius: var(--r3); padding: 22px; transition: border-color .13s; }
.node-card:hover { border-color: var(--line2); }
.node-card.offline { opacity: .38; }

.nch { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.nch-left { display: flex; align-items: center; gap: 10px; }
.nc-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.nc-dot.online { background: var(--grn2); box-shadow: 0 0 10px rgba(80,216,136,.45); }
.nc-dot.offline { background: var(--t3); }
.nc-name { font-size: 13px; font-weight: 500; color: var(--t0); }
.nc-loc { font-family: var(--mono); font-size: 8px; color: var(--t2); margin-top: 2px; letter-spacing: .5px; }
.nc-badge { font-family: var(--mono); font-size: 8px; letter-spacing: 1.5px; text-transform: uppercase; padding: 3px 8px; border-radius: 3px; border: 1px solid var(--line2); color: var(--t2); background: var(--bg2); }
.nc-badge.online { color: var(--grn2); border-color: rgba(80,216,136,.2); background: rgba(80,216,136,.05); }

.nc-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 5px; margin-bottom: 14px; }
.nc-stat { background: var(--bg2); border: 1px solid var(--line); border-radius: var(--r2); padding: 10px 8px; text-align: center; }
.nc-stat-val { font-family: var(--mono); font-size: 13px; font-weight: 500; color: var(--t0); margin-bottom: 3px; }
.nc-stat-lbl { font-family: var(--mono); font-size: 7px; color: var(--t2); letter-spacing: 1.5px; text-transform: uppercase; }

.nc-sys { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.nc-tag { font-family: var(--mono); font-size: 8px; color: var(--t2); background: var(--bg2); border: 1px solid var(--line); padding: 2px 8px; border-radius: 3px; }

.uptime-bar { margin-top: 4px; }
.uptime-bar-head { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 8px; color: var(--t2); margin-bottom: 6px; letter-spacing: 1.5px; text-transform: uppercase; }
.uptime-bar-track { height: 2px; background: var(--bg3); border-radius: 1px; overflow: hidden; }
.uptime-bar-fill { height: 100%; transition: width 1.4s cubic-bezier(.16,1,.3,1); }
.uptime-bar-fill.online { background: var(--grn2); }
.uptime-bar-fill.offline { background: var(--t3); }

.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 30px; }
.info-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: var(--bg1); border: 1px solid var(--line); border-radius: var(--r2); }
.info-row-key { font-family: var(--mono); font-size: 8px; color: var(--t2); letter-spacing: 1.5px; text-transform: uppercase; }
.info-row-val { font-family: var(--mono); font-size: 10px; color: var(--t1); }

.status-loading { display: flex; align-items: center; justify-content: center; height: 200px; font-family: var(--mono); font-size: 10px; color: var(--t2); gap: 10px; letter-spacing: 1px; }
.status-spinner { width: 13px; height: 13px; border: 1.5px solid var(--line2); border-top-color: var(--t1); border-radius: 50%; animation: spin .8s linear infinite; }

/* ══ NODES PAGE ══════════════════════════════════════════════════════════════ */
.nodes-page { display: none; flex: 1; overflow-y: auto; padding: 30px; background: var(--bg); }
.nodes-page.visible { display: block; }
.node-row { background: var(--bg1); border: 1px solid var(--line); border-radius: var(--r3); padding: 17px 20px; display: flex; align-items: center; gap: 14px; transition: border-color .13s, transform .12s; margin-bottom: 5px; }
.node-row:hover { border-color: var(--line2); transform: translateX(3px); }
.node-row-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; transition: background .3s; }
.node-row-dot.online { background: var(--grn2); box-shadow: 0 0 8px rgba(80,216,136,.4); }
.node-row-dot.offline { background: var(--t3); }
.node-row-info { flex: 1; min-width: 0; }
.node-row-name { font-size: 13px; font-weight: 500; color: var(--t0); margin-bottom: 2px; }
.node-row-meta { font-family: var(--mono); font-size: 9px; color: var(--t2); }
.node-row-actions { display: flex; gap: 5px; flex-shrink: 0; }
.add-node-form { background: var(--bg1); border: 1px solid var(--line2); border-radius: var(--r3); padding: 24px; margin-top: 6px; }
.add-node-title { font-family: var(--mono); font-size: 8px; letter-spacing: 2.5px; color: var(--t2); text-transform: uppercase; margin-bottom: 18px; }
.add-node-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.add-node-full { grid-column: 1/-1; }

/* ══ STATUSBAR ═══════════════════════════════════════════════════════════════ */
.statusbar { height: 24px; background: var(--bg1); border-top: 1px solid var(--line); padding: 0 20px; display: flex; align-items: center; gap: 20px; flex-shrink: 0; }
.sb-stat { font-family: var(--mono); font-size: 8px; color: var(--t3); letter-spacing: .5px; }
.sb-stat b { color: var(--t2); }
.sb-right { margin-left: auto; }

/* ══ UPLOAD PROGRESS ════════════════════════════════════════════════════════ */
.uprog { position: fixed; bottom: 30px; right: 20px; width: 285px; background: var(--bg2); border: 1px solid var(--line3); border-radius: var(--r3); padding: 16px 18px; display: none; z-index: 600; box-shadow: var(--shadow); }
.uprog.visible { display: block; animation: fadeUp .22s cubic-bezier(.16,1,.3,1); }
@keyframes fadeUp { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
.uprog-name { font-size: 12px; font-weight: 500; color: var(--t0); margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.uprog-sub { font-family: var(--mono); font-size: 9px; color: var(--t2); margin-bottom: 12px; }
.uprog-track { height: 2px; background: var(--bg4); border-radius: 1px; overflow: hidden; }
.uprog-fill { height: 100%; background: var(--ac); width: 0%; transition: width .12s ease; }
.uprog-pct { font-family: var(--mono); font-size: 9px; color: var(--t2); text-align: right; margin-top: 6px; }

/* ══ CONTEXT MENU ═══════════════════════════════════════════════════════════ */
.ctx { position: fixed; background: var(--bg2); border: 1px solid var(--line3); border-radius: var(--r3); padding: 5px; min-width: 170px; z-index: 9000; box-shadow: var(--shadow2); display: none; }
.ctx.open { display: block; animation: ctxIn .13s cubic-bezier(.16,1,.3,1); }
@keyframes ctxIn { from { opacity:0; transform:scale(.93) translateY(-6px); } to { opacity:1; transform:scale(1) translateY(0); } }
.ctx-item { display: flex; align-items: center; gap: 9px; padding: 8px 11px; border-radius: var(--r); cursor: pointer; font-size: 12px; color: var(--t1); transition: background .07s, color .07s; user-select: none; font-weight: 400; }
.ctx-item:hover { background: var(--bg3); color: var(--t0); }
.ctx-item.danger { color: var(--red2); }
.ctx-item.danger:hover { background: rgba(208,64,64,.08); }
.ctx-item svg { width: 12px; height: 12px; flex-shrink: 0; opacity: .4; stroke-width: 1.5; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* ══ TOAST ═══════════════════════════════════════════════════════════════════ */
.toast { position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%); padding: 10px 18px; background: var(--bg2); border: 1px solid var(--line3); border-radius: var(--r2); font-family: var(--mono); font-size: 10px; color: var(--t0); display: none; z-index: 9999; box-shadow: var(--shadow); white-space: nowrap; letter-spacing: .5px; }
.toast.show { display: flex; align-items: center; gap: 9px; animation: ctxIn .16s cubic-bezier(.16,1,.3,1); }
.toast.success { border-left: 2px solid var(--grn2); }
.toast.error { border-left: 2px solid var(--red2); }
.tdot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; }
.toast.success .tdot { background: var(--grn2); box-shadow: 0 0 6px var(--grn); }
.toast.error .tdot { background: var(--red2); }

/* ══ MODALS ══════════════════════════════════════════════════════════════════ */
.overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.75); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.overlay.open { display: flex; }
.modal { background: var(--bg2); border: 1px solid var(--line3); border-radius: var(--r3); width: 100%; max-width: 400px; overflow: hidden; animation: modalIn .22s cubic-bezier(.16,1,.3,1); box-shadow: var(--shadow2); }
@keyframes modalIn { from { opacity:0; transform:scale(.94) translateY(14px); } to { opacity:1; transform:scale(1) translateY(0); } }
.modal-wide { max-width: 560px; }
.modal-xl { max-width: 820px; }
.mhead { padding: 16px 20px; border-bottom: 1px solid var(--line2); font-size: 11px; font-weight: 500; color: var(--t0); display: flex; align-items: center; gap: 8px; font-family: var(--mono); letter-spacing: .5px; }
.mbody { padding: 20px; }
.mfoot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 7px; background: rgba(0,0,0,.2); }
.minput { width: 100%; padding: 11px 14px; background: var(--bg3); border: 1px solid var(--line2); color: var(--t0); font-size: 13px; font-family: var(--sans); font-weight: 400; outline: none; border-radius: var(--r2); transition: border-color .14s, box-shadow .14s; margin-bottom: 9px; }
.minput:focus { border-color: var(--line3); box-shadow: 0 0 0 3px rgba(120,96,168,.08); }
.minput:last-child { margin-bottom: 0; }
.minput::placeholder { color: var(--t3); }
.mdesc { font-size: 13px; color: var(--t1); line-height: 1.7; font-weight: 400; }
.mdesc strong { color: var(--t0); font-weight: 500; }
.mselect { width: 100%; padding: 11px 14px; background: var(--bg3); border: 1px solid var(--line2); color: var(--t0); font-size: 11px; font-family: var(--mono); outline: none; border-radius: var(--r2); margin-bottom: 9px; }
.mselect option { background: var(--bg2); }
.mbtn { height: 34px; display: inline-flex; align-items: center; gap: 5px; padding: 0 16px; background: var(--bg3); border: 1px solid var(--line2); color: var(--t1); font-size: 9px; font-family: var(--mono); letter-spacing: 1px; text-transform: uppercase; cursor: pointer; border-radius: var(--r2); transition: all .11s; }
.mbtn:hover { background: var(--bg4); border-color: var(--line3); color: var(--t0); }
.mbtn.primary { background: var(--t0); border-color: var(--t0); color: var(--bg); font-weight: 700; }
.mbtn.primary:hover { background: var(--ac); border-color: var(--ac); box-shadow: 0 2px 12px rgba(200,184,232,.2); }
.mbtn.danger { color: var(--red2); }
.mbtn.danger:hover { border-color: rgba(208,64,64,.3); background: rgba(208,64,64,.07); }
.editor-ta { width: 100%; min-height: 400px; background: var(--bg); border: 1px solid var(--line2); color: var(--t0); padding: 18px; font-family: var(--mono); font-size: 12px; line-height: 1.9; resize: vertical; outline: none; border-radius: var(--r2); transition: border-color .13s; }
.editor-ta:focus { border-color: var(--line3); }

.user-tbl { width: 100%; border-collapse: collapse; }
.user-tbl th { font-family: var(--mono); font-size: 7px; color: var(--t2); letter-spacing: 2.5px; text-transform: uppercase; text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.user-tbl td { font-size: 12px; color: var(--t1); padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.user-tbl tr:last-child td { border-bottom: none; }
.user-tbl tr:hover td { background: rgba(255,255,255,.01); }
.rbadge { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 8px; font-weight: 600; letter-spacing: 1.5px; text-transform: uppercase; font-family: var(--mono); border: 1px solid var(--line); }
.rbadge.admin { background: rgba(168,144,208,.08); color: var(--ac); border-color: rgba(168,144,208,.2); }
.rbadge.user  { background: var(--bg3); color: var(--t2); }

.add-form { display: grid; grid-template-columns: 1fr 1fr 90px auto; gap: 6px; align-items: end; margin-top: 14px; }
.add-form .minput, .add-form .mselect { margin: 0; }
.form-err { font-family: var(--mono); font-size: 9px; color: var(--red2); margin-top: 7px; display: none; letter-spacing: .3px; }
.sect-title { font-family: var(--mono); font-size: 7px; font-weight: 600; color: var(--t2); letter-spacing: 3px; text-transform: uppercase; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.upload-input { display: none; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 768px) {
  .sidebar { display: none; }
  .fl-date, .fl-size { display: none; }
  .uchip { display: none; }
  .login-h { font-size: 42px; }
}