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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #1a1a2e;
    color: #e0e0e0;
    min-height: 100vh;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 2rem;
    background: #16213e;
    border-bottom: 1px solid #0f3460;
}

header h1 {
    font-size: 1.4rem;
    color: #e94560;
}

.status {
    padding: 0.3rem 0.8rem;
    border-radius: 12px;
    font-size: 0.8rem;
    font-weight: 600;
}

.status.connected {
    background: #0a3d0a;
    color: #4ade80;
}

.status.disconnected {
    background: #3d0a0a;
    color: #f87171;
}

main {
    display: flex;
    padding: 2rem;
    gap: 2rem;
    height: calc(100vh - 60px);
}

#left-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
}

#right-col {
    width: 400px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
}

#house-blueprint {
    width: 100%;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    display: flex;
    align-items: start;
}

#house-svg {
    width: 100%;
    height: 100%;
    touch-action: manipulation;
}

/* Room styles in SVG */
.room-rect {
    stroke: #0f3460;
    stroke-width: 2;
    transition: fill 0.4s ease;
}

.room-rect.off {
    fill: #1a1a2e;
}

.room-rect.on {
    fill: #f5c542;
    filter: drop-shadow(0 0 15px rgba(245, 197, 66, 0.5));
}

.room-label {
    fill: #e0e0e0;
    font-size: 14px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    text-anchor: middle;
    pointer-events: none;
    font-weight: 600;
}

.room-label.on {
    fill: #1a1a2e;
}

.room-icon {
    fill: #666;
    font-size: 24px;
    text-anchor: middle;
    pointer-events: none;
    transition: fill 0.4s ease;
}

.room-icon.on {
    fill: #1a1a2e;
}

#command-panel {
    background: #16213e;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #0f3460;
    flex-shrink: 0;
}

#command-panel h2 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
    color: #e94560;
}

#command-panel input {
    width: calc(100% - 80px);
    padding: 0.6rem 1rem;
    border: 1px solid #0f3460;
    border-radius: 8px;
    background: #1a1a2e;
    color: #e0e0e0;
    font-size: 0.9rem;
    outline: none;
}

#command-panel input:focus {
    border-color: #e94560;
}

#command-panel button {
    width: 70px;
    padding: 0.6rem;
    border: none;
    border-radius: 8px;
    background: #e94560;
    color: white;
    font-weight: 600;
    cursor: pointer;
    margin-left: 8px;
}

#command-panel button:hover {
    background: #c73652;
}

#command-log {
    margin-top: 1rem;
    height: 150px;
    overflow-y: auto;
    font-size: 0.8rem;
    color: #999;
}

#command-log .log-entry {
    padding: 0.3rem 0;
    border-bottom: 1px solid #0f3460;
}

#command-log .log-entry.success {
    color: #4ade80;
}

#command-log .log-entry.error {
    color: #f87171;
}

#pipeline-log-panel {
    flex: 1;
    background: #16213e;
    border-radius: 12px;
    padding: 1.5rem;
    border: 1px solid #0f3460;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#pipeline-log-panel h2 {
    font-size: 1rem;
    margin-bottom: 0.8rem;
    color: #e94560;
}

#pipeline-log {
    flex: 1;
    overflow-y: auto;
    font-size: 0.8rem;
    font-family: "SF Mono", "Fira Code", "Cascadia Code", monospace;
    color: #999;
    min-height: 0;
}

.pipeline-entry {
    padding: 0.5rem 0;
    border-bottom: 1px solid #0f3460;
    line-height: 1.5;
}

.pl-time {
    color: #666;
}

.pl-phone {
    color: #60a5fa;
}

.pl-msg {
    color: #e0e0e0;
}

.pl-resp {
    color: #4ade80;
}

.pl-timings {
    color: #f59e0b;
    font-size: 0.75rem;
}

@media (max-width: 800px) {
    main {
        flex-direction: column;
        height: auto;
        padding: 1rem;
    }

    #right-col {
        width: 100%;
    }

    #pipeline-log-panel {
        max-height: 300px;
    }

    header {
        padding: 0.8rem 1rem;
    }

    #command-panel input {
        width: calc(100% - 70px);
    }
}
