html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    height: 100%;
    background: #1e1e1e;
    color: #ddd;
}

.page {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

main {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 0.5rem;
    min-height: 0;
    gap: 0.5rem;
}

.toolbar {
    display: flex;
    gap: 0.25rem;
    align-items: center;
    flex-wrap: wrap;
    background: #2a2a2a;
    padding: 0.5rem;
    border-radius: 4px;
}

.toolbar .url {
    flex: 1;
    min-width: 250px;
    padding: 0.35rem 0.5rem;
    background: #1e1e1e;
    color: #ddd;
    border: 1px solid #555;
    border-radius: 3px;
    font-family: monospace;
}

.toolbar .status {
    margin-left: auto;
    font-size: 0.85rem;
    color: #aaa;
}

.btn {
    padding: 0.4rem 0.75rem;
    background: #3a3a3a;
    color: #ddd;
    border: 1px solid #555;
    border-radius: 3px;
    cursor: pointer;
    font-size: 0.85rem;
}
.btn:hover:not(:disabled) { background: #4a4a4a; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: #0d6efd; border-color: #0d6efd; color: white; }
.btn.primary:hover:not(:disabled) { background: #0b5ed7; }

.empty {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #888;
}

.vnc-grid {
    display: grid;
    flex: 1;
    gap: 0.25rem;
    min-height: 0;
    align-items: stretch;
    grid-auto-rows: 1fr;
}

.vnc-tile {
    display: flex;
    flex-direction: column;
    border: 1px solid #444;
    border-radius: 3px;
    overflow: hidden;
    min-height: 0;
    background: black;
}

.vnc-tile.popped {
    position: fixed;
    inset: 1rem;
    z-index: 1000;
    box-shadow: 0 0 2rem rgba(0,0,0,0.8);
    border-color: #0d6efd;
}

.vnc-controls {
    display: flex;
    gap: 0.25rem;
    padding: 0.25rem;
    background: #2a2a2a;
    align-items: center;
    flex-shrink: 0;
}

.vnc-controls .vnc-label {
    font-family: monospace;
    font-size: 0.8rem;
    color: #ddd;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.vnc-controls .vnc-status {
    font-size: 0.75rem;
    color: #999;
    margin-right: auto;
    margin-left: 0.5rem;
}

.vnc-controls .vnc-status[data-state="connected"] { color: #4caf50; }
.vnc-controls .vnc-status[data-state="error"] { color: #f44336; }
.vnc-controls .vnc-status[data-state="connecting"] { color: #ff9800; }

.vnc-screen {
    flex: 1;
    min-height: 0;
    background: black;
    overflow: hidden;
    position: relative;
}

.vnc-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #aaa;
    font-size: 1.1rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    background: repeating-linear-gradient(45deg, #1a1a1a, #1a1a1a 10px, #222 10px, #222 20px);
}

.vnc-state-badge {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
    margin-right: auto;
    margin-left: 0.5rem;
    background: #444;
    color: #ddd;
}
.vnc-state-badge.state-running { background: #1f6f30; color: #d4f5d4; }
.vnc-state-badge.state-pending { background: #b06b00; color: #ffe2b3; }
.vnc-state-badge.state-stopping { background: #8a2a2a; color: #ffd0d0; }
.vnc-state-badge.state-stopped { background: #444; color: #aaa; }

.vnc-progress-badge {
    font-family: monospace;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 2px;
    background: #0d6efd;
    color: white;
}

.vnc-progress-overlay {
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 4px;
    background: rgba(0,0,0,0.5);
    pointer-events: none;
}
.vnc-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #0d6efd, #4caf50);
    transition: width 0.5s linear;
}
