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

html, body {
    background: #1a1b26;
    color: #c0caf5;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    height: 100%;
    overflow: hidden;
    position: fixed;
    width: 100%;
    touch-action: manipulation;
}

#app {
    display: flex;
    flex-direction: column;
    height: 100dvh;
    position: relative;
    overflow: hidden;
}

/* Terminal area */
#terminal-container {
    flex: 1;
    position: relative;
    overflow: hidden;
}

.session-terminal {
    position: absolute;
    inset: 0;
    padding: 0;
    background: #1a1b26;
}

#placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #565f89;
    font-size: 16px;
}

#placeholder strong {
    color: #7aa2f7;
    font-size: 18px;
}

/* Tab bar */
#tab-bar {
    display: flex;
    align-items: center;
    background: #16161e;
    border-top: 1px solid #292e42;
    height: 36px;
    padding: 0 4px;
    gap: 2px;
    flex-shrink: 0;
}

#new-tab-btn {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    background: #292e42;
    color: #7aa2f7;
    border: 1px solid #3b4261;
    border-radius: 4px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

#new-tab-btn:hover {
    background: #3b4261;
}

#tabs {
    display: flex;
    gap: 2px;
    overflow-x: auto;
    flex: 1;
    scrollbar-width: none;
}

#tabs::-webkit-scrollbar {
    display: none;
}

.tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    background: #1f2335;
    border: 1px solid #292e42;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    color: #565f89;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.1s, border-color 0.1s;
    -webkit-tap-highlight-color: transparent;
}

.tab:hover {
    background: #292e42;
}

.tab.active {
    background: #292e42;
    color: #c0caf5;
    border-color: #7aa2f7;
}

.tab-status {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.tab-name {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tab-close {
    background: none;
    border: none;
    color: #565f89;
    cursor: pointer;
    font-size: 14px;
    padding: 0 2px;
    line-height: 1;
    -webkit-tap-highlight-color: transparent;
}

.tab-close:hover {
    color: #f7768e;
}

/* Host picker popup */
#host-picker {
    position: absolute;
    bottom: 65px;
    left: 4px;
    background: #1f2335;
    border: 1px solid #3b4261;
    border-radius: 6px;
    padding: 4px;
    z-index: 10;
    min-width: 220px;
    max-width: 320px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.5);
}

#host-picker.hidden {
    display: none;
}

.host-option {
    padding: 8px 12px;
    cursor: pointer;
    border-radius: 4px;
    transition: background 0.1s;
}

.host-option:hover {
    background: #292e42;
}

.host-option-name {
    font-weight: 500;
    font-size: 13px;
    color: #c0caf5;
}

.host-option-info {
    font-size: 11px;
    color: #565f89;
    margin-top: 1px;
}

.host-picker-empty {
    padding: 12px;
    color: #565f89;
    font-size: 13px;
    text-align: center;
}

/* Status bar */
#status-bar {
    height: 24px;
    background: #16161e;
    border-top: 1px solid #292e42;
    display: flex;
    align-items: center;
    padding: 0 12px;
    gap: 8px;
    font-size: 11px;
    flex-shrink: 0;
}

.status-spacer {
    flex: 1;
}

.shortcut-btn {
    background: none;
    border: 1px solid #3b4261;
    color: #7aa2f7;
    height: 18px;
    padding: 0 6px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    line-height: 1;
    display: flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    margin-right: 4px;
}

.shortcut-btn:hover {
    background: #292e42;
}

.zoom-btn {
    background: none;
    border: 1px solid #3b4261;
    color: #7aa2f7;
    width: 20px;
    height: 18px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    line-height: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.zoom-btn:hover {
    background: #292e42;
}

#zoom-level {
    font-size: 10px;
    color: #565f89;
    min-width: 30px;
    text-align: center;
}

.status {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.status.disconnected { background: #565f89; }
.status.connecting   { background: #e0af68; animation: pulse 1s infinite; }
.status.connected    { background: #9ece6a; }
.status.error        { background: #f7768e; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%      { opacity: 0.4; }
}

/* xterm.js overrides */
.xterm {
    height: 100%;
}

.xterm .xterm-viewport {
    background-color: #1a1b26 !important;
}

.xterm .xterm-screen {
    width: 100% !important;
}


/* Scrollbar */
::-webkit-scrollbar {
    width: 6px;
}
::-webkit-scrollbar-track {
    background: transparent;
}
::-webkit-scrollbar-thumb {
    background: #292e42;
    border-radius: 3px;
}

/* Mobile tweaks */
@media (max-width: 640px) {
    #tab-bar {
        height: 40px;
    }

    .tab {
        padding: 6px 10px;
        font-size: 13px;
    }

    #status-bar {
        height: 28px;
        font-size: 12px;
    }
}
