* { box-sizing: border-box; }
body { margin: 0; background: #0f172a; color: #e5e7eb; font: 14px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button { border: 1px solid #334155; background: #1e293b; color: #e5e7eb; border-radius: 10px; padding: 8px 12px; cursor: pointer; }
button:hover { background: #273449; }
button:disabled { opacity: .5; cursor: not-allowed; }
.primary { background: #2563eb; border-color: #2563eb; }
.primary:hover { background: #1d4ed8; }
input, select, textarea { width: 100%; border: 1px solid #334155; background: #111827; color: #e5e7eb; border-radius: 10px; padding: 9px 10px; outline: none; }
textarea { resize: vertical; }
label { display: grid; gap: 6px; color: #cbd5e1; }
.shell { display: grid; grid-template-columns: 320px minmax(480px, 1fr) 360px; min-height: 100vh; }
.left, .right { background: #111827; border-right: 1px solid #243041; padding: 16px; overflow: auto; max-height: 100vh; }
.right { border-right: 0; border-left: 1px solid #243041; }
.brand { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.brand strong { font-size: 20px; }
.brand a { color: #93c5fd; text-decoration: none; }
.toolbar { display: grid; gap: 8px; margin-bottom: 12px; }
.groups { display: grid; gap: 3px; margin-bottom: 14px; }
.tree-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 4px; border-radius: 10px; color: #cbd5e1; }
.tree-main { display: flex; align-items: center; gap: 6px; min-width: 0; padding: 7px 8px; border: 0; background: transparent; text-align: left; border-radius: 10px; }
.tree-main:hover, .tree-row.active .tree-main { background: #1d4ed8; color: white; }
.tree-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tree-count { color: #94a3b8; font-size: 12px; }
.tree-action { border: 0; background: transparent; padding: 4px 6px; color: #94a3b8; }
.tree-action:hover { background: #263244; color: white; }
.hosts { display: grid; gap: 8px; }
.host { border: 1px solid #263244; border-radius: 14px; padding: 10px; background: #0f172a; cursor: pointer; }
.host.active { border-color: #60a5fa; box-shadow: 0 0 0 1px #60a5fa inset; }
.host-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.host strong { display: block; color: white; }
.host span { display: block; color: #93a4b8; font-size: 12px; word-break: break-all; }
.host .note { color: #cbd5e1; margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.status-badge { flex: 0 0 auto; border: 1px solid #334155; border-radius: 999px; padding: 1px 7px; font-size: 11px; color: #cbd5e1; background: #111827; }
.status-badge.online { border-color: #22c55e; color: #bbf7d0; background: rgba(34,197,94,.12); }
.status-badge.connecting { border-color: #38bdf8; color: #bae6fd; background: rgba(56,189,248,.12); }
.status-badge.offline { border-color: #64748b; color: #cbd5e1; }
.status-badge.error { border-color: #ef4444; color: #fecaca; background: rgba(239,68,68,.12); }
.error-text { color: #fecaca !important; }
.host-actions { display: flex; gap: 6px; margin-top: 8px; }
.host-actions button { padding: 5px 8px; font-size: 12px; }
.terminal-wrap { display: grid; grid-template-rows: auto 1fr auto; min-width: 0; }
.terminal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid #243041; background: #111827; }
.terminal-head strong, .terminal-head span { display: block; }
.terminal-head span { color: #94a3b8; font-size: 12px; }
.terminal-actions { display: flex; gap: 8px; }
.terminal { min-height: 0; background: #020617; overflow: hidden; padding: 8px; cursor: text; }
.terminal:focus-within { box-shadow: inset 0 0 0 1px rgba(96,165,250,.45); }
.terminal .xterm { height: 100%; }
.terminal .xterm-viewport { background: #020617 !important; }
.command-bar { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 8px; padding: 12px; border-top: 1px solid #243041; background: #111827; }
.command-bar textarea { min-height: 40px; max-height: 150px; resize: vertical; line-height: 1.45; }
.command-bar button { min-height: 40px; }
.card { border: 1px solid #263244; border-radius: 16px; background: #0f172a; padding: 14px; margin-bottom: 14px; }
.card h2 { margin: 0 0 12px; font-size: 16px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.section-head h2 { margin: 0; }
.section-head button { padding: 5px 9px; font-size: 12px; }
form { display: grid; gap: 10px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row { display: flex; gap: 8px; }
.hint { color: #94a3b8; margin-top: -6px; }
.commands { display: grid; gap: 8px; margin-top: 10px; }
.cmd { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 8px; border: 1px solid #334155; border-radius: 12px; padding: 7px 8px; background: #111827; }
.cmd-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; color: #e5e7eb; }
.cmd .row { justify-content: flex-end; gap: 5px; }
.cmd button { padding: 5px 8px; font-size: 12px; border-radius: 8px; }
.modal { width: min(620px, calc(100vw - 32px)); border: 1px solid #334155; border-radius: 16px; background: #0f172a; color: #e5e7eb; padding: 16px; box-shadow: 0 22px 70px rgba(0,0,0,.55); }
.modal::backdrop { background: rgba(2, 6, 23, .72); }
.modal h2 { margin: 0 0 6px; font-size: 18px; }
.modal-actions { justify-content: flex-end; }
.hidden { display: none !important; }
@media (max-width: 1180px) { .shell { grid-template-columns: 280px 1fr; } .right { grid-column: 1 / -1; max-height: none; border-left: 0; border-top: 1px solid #243041; } }
@media (max-width: 760px) { .shell { display: block; } .left, .right { max-height: none; } .terminal { min-height: 420px; } }
