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

:root {
    --bg: #1a1a2e;
    --bg2: #16213e;
    --bg3: #0f3460;
    --card: #1e2a4a;
    --text: #e0e0e0;
    --text2: #a0a0b0;
    --accent: #00d4aa;
    --accent2: #0ea5e9;
    --danger: #ef4444;
    --warn: #f59e0b;
    --border: #2a3a5e;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}

/* Login */
.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    background: var(--card);
    padding: 2.5rem;
    border-radius: 12px;
    text-align: center;
    width: 340px;
    border: 1px solid var(--border);
}

.login-card h1 { color: var(--accent); font-size: 2rem; }
.login-card .subtitle { color: var(--text2); margin: 0.5rem 0 1.5rem; }

.login-card input {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    color: var(--text);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.login-card button {
    width: 100%;
    padding: 0.75rem;
    border: none;
    border-radius: 6px;
    background: var(--accent);
    color: var(--bg);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
}

.login-card button:hover { opacity: 0.9; }
.error { color: var(--danger); margin-bottom: 1rem; font-size: 0.9rem; }

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg2);
    border-bottom: 1px solid var(--border);
}

.topbar h1 { font-size: 1.2rem; color: var(--accent); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.back-link { color: var(--accent); text-decoration: none; font-size: 1.1rem; }
.btn-link { color: var(--text2); text-decoration: none; font-size: 0.9rem; }
.btn-link:hover { color: var(--text); }

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online { background: var(--accent); }
.status-dot.offline { background: #666; }

/* Table */
.table-container {
    padding: 1rem;
    overflow-x: auto;
}

.pc-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.pc-table th {
    text-align: left;
    padding: 0.6rem 0.75rem;
    color: var(--text2);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid var(--border);
    white-space: nowrap;
}

.pc-table td {
    padding: 0.6rem 0.75rem;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

.pc-table tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}

.pc-table tbody tr:hover { background: var(--bg3); }
.pc-table tbody tr.row-offline { opacity: 0.5; }

.col-hostname { font-weight: 600; }
.col-status { text-align: center; width: 50px; }
.col-speed { color: var(--text2); font-size: 0.85rem; }

.col-metric {
    min-width: 120px;
}

.cell-bar-wrap {
    height: 6px;
    background: var(--bg);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 2px;
}

.cell-bar {
    height: 100%;
    border-radius: 3px;
    transition: width 0.3s;
}

.cell-bar.cpu-bar { background: var(--accent2); }
.cell-bar.gpu-bar { background: #7c3aed; }
.cell-bar.ram-bar { background: var(--accent); }
.cell-bar.disk-bar { background: var(--warn); }

.cell-val {
    font-size: 0.75rem;
    color: var(--text2);
}

/* Detail layout */
.detail-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1rem;
    padding: 1rem;
    height: calc(100vh - 52px);
}

.detail-left {
    display: flex;
    flex-direction: column;
}

.screenshot-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #111;
    border-radius: 8px;
    overflow: hidden;
}

.screenshot-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.detail-right {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    overflow-y: auto;
}

/* Metrics panel */
.metrics-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.metrics-panel h3 { font-size: 0.9rem; color: var(--text2); margin-bottom: 0.75rem; }

.metric-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.metric-row label { width: 36px; font-size: 0.8rem; color: var(--text2); }
.metric-row span { width: 40px; text-align: right; font-size: 0.8rem; }

.bar-bg {
    flex: 1;
    height: 8px;
    background: var(--bg);
    border-radius: 4px;
    overflow: hidden;
}

.bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.3s;
}

.cpu-bar { background: var(--accent2); }
.ram-bar { background: var(--accent); }
.disk-bar { background: var(--warn); }

.metric-info {
    display: flex;
    gap: 1rem;
    margin-top: 0.75rem;
    font-size: 0.8rem;
    color: var(--text2);
}

.metric-info b { color: var(--text); }

/* GPU panel */
.gpu-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.gpu-panel h3 { font-size: 0.9rem; color: var(--text2); margin-bottom: 0.75rem; }

.gpu-card {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.gpu-card:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.gpu-name { font-size: 0.8rem; color: var(--accent2); margin-bottom: 0.4rem; }
.gpu-bar { background: #7c3aed; }
.gpu-mem-bar { background: #a855f7; }

.gpu-info {
    display: flex;
    gap: 1rem;
    margin-top: 0.4rem;
    font-size: 0.75rem;
    color: var(--text2);
}

.gpu-info b { color: var(--text); }

/* Speedtest panel */
.speedtest-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

.speedtest-panel h3 { font-size: 0.9rem; color: var(--text2); margin-bottom: 0.75rem; }

.speedtest-info {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.speedtest-item {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.speedtest-label { font-size: 0.7rem; color: var(--text2); }
.speedtest-value { font-size: 1rem; font-weight: 600; color: var(--text); }

/* Chart */
.chart-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
}

/* Terminal */
.terminal-panel {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 1rem;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 200px;
}

.terminal-panel h3 { font-size: 0.9rem; color: var(--text2); margin-bottom: 0.5rem; }

.terminal-output {
    flex: 1;
    background: #0d0d0d;
    border-radius: 4px;
    padding: 0.5rem;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    min-height: 100px;
    max-height: 300px;
}

.terminal-output .cmd-line { color: var(--accent); }
.terminal-output .stdout { color: var(--text); }
.terminal-output .stderr { color: var(--danger); }

.terminal-input-row {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.5rem;
    align-items: center;
}

.terminal-input-row .prompt { color: var(--accent); font-family: monospace; }

.terminal-input-row input {
    flex: 1;
    padding: 0.5rem;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg);
    color: var(--text);
    font-family: monospace;
    font-size: 0.85rem;
}

.terminal-input-row button {
    padding: 0.5rem 1rem;
    border: none;
    border-radius: 4px;
    background: var(--accent);
    color: var(--bg);
    font-weight: 600;
    cursor: pointer;
}

.terminal-input-row button:hover { opacity: 0.9; }

/* Responsive */
@media (max-width: 900px) {
    .detail-layout {
        grid-template-columns: 1fr;
        height: auto;
    }
    .screenshot-container { min-height: 300px; }
}
