* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: #0d1117;
  color: #c9d1d9;
  font-family: 'Segoe UI', system-ui, sans-serif;
  height: 100vh;
  overflow: hidden;
}
.page { display: flex; height: 100vh; }
.loader-overlay {
  position: fixed; top:0; left:0; right:0; bottom:0;
  background: #0d1117; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
}
.loader {
  width: 40px; height: 40px;
  border: 3px solid #30363d;
  border-top-color: #1f6feb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.hidden { display: none !important; }

/* LOGIN */
#loginPage { align-items: center; justify-content: center; }
.login-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  padding: 40px;
  width: 360px;
  text-align: center;
}
.login-box h1 { color: #58a6ff; margin-bottom: 24px; font-size: 24px; }
.login-box input {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 14px;
  outline: none;
}
.login-box input:focus { border-color: #58a6ff; }
.login-box button {
  width: 100%;
  background: #238636;
  border: none;
  color: #fff;
  padding: 12px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.login-box button:hover { background: #2ea043; }
.error { color: #f85149; font-size: 12px; margin-top: 8px; }

/* APP */
#appPage { flex-direction: row; }
#sidebar {
  width: 220px;
  background: #161b22;
  border-right: 1px solid #30363d;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
}
.logo {
  padding: 0 20px 16px;
  font-size: 18px;
  font-weight: 700;
  color: #58a6ff;
  border-bottom: 1px solid #30363d;
}
nav { flex: 1; padding: 12px 0; }
nav a {
  display: block;
  padding: 10px 20px;
  color: #8b949e;
  text-decoration: none;
  font-size: 14px;
  border-left: 3px solid transparent;
}
nav a:hover, nav a.active {
  color: #c9d1d9;
  background: #1f6feb22;
  border-left-color: #1f6feb;
}
.user-info {
  padding: 12px 20px;
  border-top: 1px solid #30363d;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.user-info button {
  background: #21262d;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
}
.user-info button:hover { background: #30363d; }

#content {
  flex: 1;
  padding: 24px 32px;
  overflow-y: auto;
}

/* TABS */
.tab h2 { margin-bottom: 20px; font-size: 20px; }
.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }

/* SEARCH */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap .search-icon {
  position: absolute;
  left: 10px;
  width: 16px;
  height: 16px;
  color: #8b949e;
  pointer-events: none;
}
.search-wrap .search-input {
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 8px 12px 8px 34px;
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  width: 260px;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.search-wrap .search-input:focus {
  border-color: #58a6ff;
  box-shadow: 0 0 0 3px rgba(88,166,255,0.15);
}
.search-wrap .search-input::placeholder { color: #484f58; }
.proxy-bulk-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.data-table th input[type="checkbox"],
.data-table td input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer; accent-color: #1f6feb;
}

/* STATS */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-card {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 10px;
  padding: 20px;
  text-align: center;
}
.stat-card.green { border-color: #238636; }
.stat-card.red { border-color: #f85149; }
.stat-card.blue { border-color: #1f6feb; }
.stat-card.orange { border-color: #d29922; }
.stat-num { font-size: 32px; font-weight: 700; margin-bottom: 4px; }
.stat-card.green .stat-num { color: #3fb950; }
.stat-card.red .stat-num { color: #f85149; }
.stat-card.blue .stat-num { color: #58a6ff; }
.stat-card.orange .stat-num { color: #d29922; }
.stat-label { font-size: 12px; color: #8b949e; text-transform: uppercase; }

/* TABLE */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #30363d;
  color: #8b949e;
  font-weight: 500;
}
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #21262d;
}
.data-table tr:hover td { background: #161b22; }
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}
.badge.online { background: #23863633; color: #3fb950; }
.badge.offline { background: #f8514933; color: #f85149; }
.badge.unknown { background: #8b949e33; color: #8b949e; }
.badge.admin { background: #1f6feb33; color: #58a6ff; }
.badge.coder { background: #d2992233; color: #d29922; }

/* BUTTONS */
.btn {
  background: #21262d;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 7px 17px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
}
.btn:hover { background: #30363d; }
.btn.primary { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.btn.primary:hover { background: #388bfd; }
.btn.danger { background: #f85149; border-color: #f85149; color: #fff; }
.btn.small { padding: 4px 10px; font-size: 14px; }

/* TERMINAL */
#tab-terminal { display: flex; flex-direction: column; height: calc(100vh - 48px); }
.term-layout {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  gap: 0;
  overflow: hidden;
}
.term-sidebar {
  width: 260px;
  background: #161b22;
  border-right: 1px solid #30363d;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}
.term-sidebar-search {
  position: relative;
  padding: 12px;
  border-bottom: 1px solid #30363d;
}
.term-sidebar-search .search-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  color: #8b949e;
  pointer-events: none;
}
.term-sidebar-search .search-input {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 6px 10px 6px 30px;
  border-radius: 6px;
  font-size: 12px;
  outline: none;
}
.term-sidebar-search .search-input:focus { border-color: #58a6ff; }
.term-shell-list {
  flex: 1;
  overflow-y: auto;
  padding: 4px;
}
.term-shell-item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 2px;
  font-size: 12px;
  line-height: 1.4;
  position: relative;
}
.term-shell-item:hover { background: #21262d; }
.term-shell-item.active {
  background: #1f6feb22;
  border-left: 3px solid #1f6feb;
}
.term-shell-item .sh-name {
  font-weight: 600;
  color: #c9d1d9;
  display: flex;
  align-items: center;
  gap: 6px;
}
.term-shell-item .sh-arrow {
  color: #8b949e;
  flex-shrink: 0;
  opacity: 0.7;
}
.term-shell-item:hover .sh-arrow {
  color: #58a6ff;
  opacity: 1;
}
.term-shell-item .sh-status {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.term-shell-item .sh-status.online { background: #3fb950; }
.term-shell-item .sh-status.offline { background: #f85149; }
.term-shell-item .sh-status.unknown { background: #8b949e; }
.term-shell-item .sh-url {
  color: #8b949e;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-shell-item .sh-meta {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 2px;
}
.term-shell-item .sh-monitor {
  font-size: 10px;
  color: #d29922;
  background: #d2992233;
  padding: 1px 4px;
  border-radius: 4px;
}
.term-shell-item .sh-comment-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 2px;
  font-size: 11px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-shell-item .sh-comment {
  color: #8b949e;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.term-shell-item .sh-comment-placeholder {
  color: #484f58;
  font-style: italic;
}
.term-shell-item .sh-edit-icon {
  color: #484f58;
  flex-shrink: 0;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s;
}
.term-shell-item:hover .sh-edit-icon {
  opacity: 1;
}
.term-shell-item .sh-edit-icon:hover {
  color: #58a6ff;
}
.term-shell-item .sh-comment-input {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 11px;
  outline: none;
  margin-top: 2px;
}
.term-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 16px;
}
.term-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid #30363d;
  margin-bottom: 16px;
}
#termTitle { font-weight: 600; flex: 1; }
.term-tabs { display: flex; gap: 10px; }
.tab-btn {
  background: #21262d;
  border: 1px solid #30363d;
  color: #8b949e;
  padding: 7px 19px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 14px;
}
.tab-btn.active { background: #1f6feb; border-color: #1f6feb; color: #fff; }
.tab-btn.danger { background: #f85149; border-color: #f85149; color: #fff; }
.tab-btn.danger:hover { background: #da3633; }

.term-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border: 1px solid #30363d;
  border-radius: 8px;
  background: #0d1117;
}
#terminal {
  flex: 1;
  overflow-y: auto;
  padding: 12px 16px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  line-height: 1.5;
}
#terminal .line { white-space: pre-wrap; word-break: break-all; margin-bottom: 2px; }
#terminal .prompt { color: #58a6ff; font-weight: bold; }
#terminal .err { color: #f85149; }
#cmdLine {
  display: flex;
  align-items: center;
  padding: 10px 16px;
  border-top: 1px solid #30363d;
  background: #161b22;
}
#cmdLine span {
  color: #58a6ff;
  font-family: monospace;
  font-weight: bold;
  margin-right: 8px;
  white-space: nowrap;
}
#cmdInput {
  flex: 1;
  background: transparent;
  border: none;
  color: #c9d1d9;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  outline: none;
  resize: none;
  overflow: hidden;
  min-height: 18px;
  max-height: 200px;
  padding: 0;
  line-height: 1.4;
}

/* FILE MANAGER */
.fm-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #30363d;
  background: #161b22;
  border-radius: 8px 8px 0 0;
}
#fmPath { font-family: monospace; font-size: 12px; color: #8b949e; }
#fmList { flex: 1; overflow-y: auto; padding: 8px 0; }
.fm-item {
  display: flex;
  align-items: center;
  padding: 8px 16px;
  cursor: pointer;
  gap: 10px;
  font-family: monospace;
  font-size: 13px;
}
.fm-item:hover { background: #21262d; }
.fm-item .icon { width: 20px; text-align: center; }
.fm-item .name { flex: 1; }
.fm-item .size { color: #8b949e; font-size: 12px; }

/* MODALS */
.modal {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: #000000aa;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal.show { display: flex; }
.modal-box {
  background: #161b22;
  border: 1px solid #30363d;
  border-radius: 12px;
  width: 420px;
  max-width: 90vw;
  padding: 24px;
}
.modal-box.wide { width: 800px; }
.modal-box h3 { margin-bottom: 16px; }
.modal-box input, .modal-box select {
  width: 100%;
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 10px 12px;
  border-radius: 8px;
  margin-bottom: 12px;
  font-size: 13px;
  outline: none;
}
.modal-box input:focus, .modal-box select:focus { border-color: #58a6ff; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.modal-box textarea {
  width: 100%;
  height: 400px;
  background: #0d1117;
  border: 1px solid #30363d;
  color: #c9d1d9;
  font-family: monospace;
  font-size: 12px;
  padding: 10px;
  border-radius: 8px;
  resize: vertical;
  outline: none;
}

/* INFO */
#infoContent {
  padding: 16px;
  font-family: monospace;
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  overflow-y: auto;
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0d1117; }
::-webkit-scrollbar-thumb { background: #30363d; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }
