* { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Consolas','Monaco',monospace; }
body { background: #0a0e14; color: #c9d1d9; }
.hidden { display: none !important; }
button { cursor: pointer; }

.login-wrap { height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, #0d2818 0%, #0a0e14 70%); }
.login-box { background: #0f1620; border: 1px solid #1f6feb; padding: 40px;
  border-radius: 8px; width: 340px; box-shadow: 0 0 40px rgba(31,111,235,.3); }
.login-box h1 { color: #58a6ff; text-align: center; margin-bottom: 6px; }
.sub { text-align: center; color: #6e7681; font-size: 12px; margin-bottom: 24px; }
.login-box input { width: 100%; padding: 12px; margin-bottom: 12px; background: #0a0e14;
  border: 1px solid #30363d; color: #c9d1d9; border-radius: 4px; }
.login-box input:focus { outline: none; border-color: #58a6ff; }
.login-box button { width: 100%; padding: 12px; background: #1f6feb; color: #fff;
  border: none; border-radius: 4px; font-weight: bold; letter-spacing: 1px; }
.login-box button:hover { background: #388bfd; }
.msg { color: #f85149; text-align: center; margin-top: 12px; font-size: 12px; }

.app { display: flex; height: 100vh; }
.sidebar { width: 220px; background: #0f1620; border-right: 1px solid #21262d;
  display: flex; flex-direction: column; padding: 20px 0; }
.brand { padding: 0 20px 20px; color: #58a6ff; font-size: 18px; font-weight: bold;
  border-bottom: 1px solid #21262d; }
.sidebar nav { flex: 1; padding: 16px 0; }
.sidebar nav a { display: block; padding: 12px 20px; color: #8b949e;
  border-left: 3px solid transparent; font-size: 14px; user-select: none; }
.sidebar nav a:hover { background: #161b22; color: #c9d1d9; }
.sidebar nav a.active { color: #58a6ff; border-left-color: #58a6ff; background: #161b22; }
.user-info { padding: 16px; border-top: 1px solid #21262d; }
.user-info #userName { display: block; color: #58a6ff; font-size: 12px; margin-bottom: 8px; }
.logout { width: 100%; padding: 10px; background: #21262d; color: #f85149;
  border: none; border-radius: 4px; }

.main { flex: 1; overflow-y: auto; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 16px 30px;
  background: #0f1620; border-bottom: 1px solid #21262d; }
.topbar h2 { font-size: 18px; }
.topbar-right { display: flex; align-items: center; gap: 16px; }
.agent-select { padding: 8px 12px; background: #0a0e14; border: 1px solid #30363d;
  color: #c9d1d9; border-radius: 4px; font-size: 12px; min-width: 200px; }
.status-dot { color: #3fb950; font-size: 12px; }
.view { padding: 30px; flex: 1; display: flex; flex-direction: column; }
#view-terminal { padding: 0; }
#view-files { padding: 0; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 24px; }
.card { background: #0f1620; border: 1px solid #21262d; padding: 20px; border-radius: 6px; }
.card h3 { color: #8b949e; font-size: 12px; font-weight: normal; margin-bottom: 10px; }
.big { font-size: 28px; color: #58a6ff; font-weight: bold; }
.big.danger { color: #f85149; }
.chart-wrap { background: #0f1620; border: 1px solid #21262d; padding: 20px; border-radius: 6px; }
.chart-wrap h3 { font-size: 14px; margin-bottom: 16px; color: #8b949e; }

.tbl { width: 100%; border-collapse: collapse; background: #0f1620; }
.tbl th, .tbl td { padding: 12px 16px; text-align: left;
  border-bottom: 1px solid #21262d; font-size: 13px; }
.tbl th { color: #8b949e; font-weight: normal; font-size: 12px; }
.badge { padding: 3px 10px; border-radius: 10px; font-size: 11px; }
.badge.block { background: #f8514933; color: #f85149; }
.badge.allow { background: #3fb95033; color: #3fb950; }
.btn-sm { padding: 6px 12px; background: #21262d; color: #c9d1d9;
  border: none; border-radius: 4px; font-size: 12px; margin-left: 4px; }
.btn-sm:hover { background: #30363d; }
.tbl button { background: transparent; color: #58a6ff; border: none; padding: 4px 8px; font-size: 14px; }

.srv-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.srv-toolbar button { padding: 10px 20px; background: #1f6feb; color: #fff;
  border: none; border-radius: 4px; }

.terminal-wrap { flex: 1; display: flex; flex-direction: column; background: #000; }
.term-tabs { display: flex; background: #0a0e14; border-bottom: 1px solid #21262d;
  overflow-x: auto; min-height: 40px; align-items: stretch; }
.term-tab { display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: #0f1620; color: #8b949e; border-right: 1px solid #21262d;
  font-size: 12px; cursor: pointer; white-space: nowrap; }
.term-tab:hover { background: #161b22; }
.term-tab.active { background: #000; color: #58a6ff; border-top: 2px solid #58a6ff; }
.term-tab .close { color: #f85149; font-size: 14px; padding: 0 4px; }
.term-tab-add { padding: 8px 16px; background: transparent; color: #8b949e;
  border: none; font-size: 12px; }
.term-tab-add:hover { color: #58a6ff; }
.term-body { flex: 1; position: relative; overflow: hidden; }
.term-instance { position: absolute; inset: 0; display: none; flex-direction: column; }
.term-instance.active { display: flex; }
.term-out { flex: 1; overflow-y: auto; padding: 16px; font-size: 13px;
  line-height: 1.5; font-family: 'Consolas',monospace; }
.term-line { white-space: pre-wrap; word-break: break-word; color: #c9d1d9; }
.term-line.err { color: #f85149; }
.term-line.cmd { color: #3fb950; }
.prompt { color: #3fb950; margin-right: 8px; }
.term-input-wrap { display: flex; align-items: center; padding: 12px 16px;
  border-top: 1px solid #21262d; background: #0a0e14; }
.term-input-wrap input { flex: 1; background: transparent; border: none; color: #c9d1d9;
  font-family: 'Consolas',monospace; font-size: 13px; outline: none; }

.fm-wrap { flex: 1; display: flex; overflow: hidden; }
.fm-side { width: 320px; background: #0f1620; border-right: 1px solid #21262d;
  display: flex; flex-direction: column; }
.fm-path { padding: 12px 16px; background: #0a0e14; color: #58a6ff;
  font-size: 12px; border-bottom: 1px solid #21262d; }
.fm-list { flex: 1; overflow-y: auto; }
.fm-item { padding: 10px 16px; font-size: 12px; border-bottom: 1px solid #161b22;
  display: flex; align-items: center; gap: 8px; cursor: pointer; }
.fm-item:hover { background: #161b22; }
.fm-item .icon { font-size: 14px; }
.fm-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-item .size { color: #6e7681; font-size: 11px; }
.fm-editor { flex: 1; display: flex; flex-direction: column; }
.fm-editor-head { display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: #0f1620; border-bottom: 1px solid #21262d; font-size: 12px; }
.fm-editor-body { flex: 1; position: relative; overflow: hidden; }
.fm-editor-body textarea, .fm-editor-body pre {
  position: absolute; inset: 0; padding: 16px; border: none; outline: none;
  font-family: 'Consolas',monospace; font-size: 13px; line-height: 1.5;
  white-space: pre; overflow: auto; tab-size: 2;
}
.fm-editor-body textarea { background: transparent; color: transparent;
  caret-color: #c9d1d9; resize: none; z-index: 2; }
.fm-editor-body pre { background: #0a0e14; margin: 0; z-index: 1; }

.monitor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.monitor-card { background: #0f1620; border: 1px solid #21262d; border-radius: 8px;
  padding: 16px; cursor: pointer; transition: all .15s; }
.monitor-card:hover { border-color: #58a6ff; }
.monitor-card.offline { opacity: 0.55; }
.monitor-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.monitor-head h4 { font-size: 14px; color: #58a6ff; }
.monitor-head small { color: #6e7681; font-size: 11px; }
.metric-row { display: flex; justify-content: space-between; font-size: 12px;
  color: #8b949e; margin-top: 8px; margin-bottom: 4px; }
.bar { height: 6px; background: #21262d; border-radius: 3px; overflow: hidden; }
.bar-fill { height: 100%; background: #3fb950; transition: width .4s; }
.bar-fill.warn { background: #d29922; }
.bar-fill.danger { background: #f85149; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.7);
  display: flex; align-items: center; justify-content: center; z-index: 1000; }
.modal-box { background: #0f1620; border: 1px solid #21262d; border-radius: 8px;
  padding: 20px; width: 90%; max-width: 900px; height: 80vh;
  display: flex; flex-direction: column; }
.modal-box h3 { margin-bottom: 12px; }
.modal-box textarea { flex: 1; background: #000; border: 1px solid #21262d;
  color: #c9d1d9; padding: 12px; font-family: 'Consolas',monospace; font-size: 12px;
  border-radius: 4px; resize: none; outline: none; min-height: 200px; }
.modal-actions { display: flex; gap: 10px; margin-top: 12px; justify-content: flex-end; }
.modal-actions button { padding: 8px 20px; border: none; border-radius: 4px; }
.modal-actions button:first-child { background: #1f6feb; color: #fff; }
.modal-actions button:last-child { background: #21262d; color: #c9d1d9; }

.srv-modal { height: auto; max-height: 90vh; overflow-y: auto; }
.srv-modal label { display: block; margin-top: 12px; margin-bottom: 4px;
  color: #8b949e; font-size: 12px; }
.srv-modal input, .srv-modal select, .srv-modal textarea {
  width: 100%; padding: 10px; background: #0a0e14; border: 1px solid #30363d;
  color: #c9d1d9; border-radius: 4px; font-size: 12px; }