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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    background: #1e1e1e;
    color: #d4d4d4;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 13px;
    display: flex;
    flex-direction: column;
}

/* ── Lock screen ──────────────────────────────────────────────────────────── */

#lock-screen {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
}

#lock-card {
    background: #252526;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    padding: 32px 40px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 320px;
}

#lock-title {
    font-size: 16px;
    font-weight: bold;
    color: #d4d4d4;
    margin-bottom: 4px;
    letter-spacing: 0.05em;
}

#api-key-input {
    background: #1e1e1e;
    border: 1px solid #3a3a3a;
    color: #d4d4d4;
    padding: 8px 10px;
    border-radius: 3px;
    font-family: inherit;
    font-size: 13px;
    outline: none;
}

#api-key-input:focus {
    border-color: #007acc;
}

#unlock-btn {
    background: #0e639c;
    border: none;
    color: #fff;
    padding: 8px;
    border-radius: 3px;
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
}

#unlock-btn:hover { background: #1177bb; }

#lock-error {
    display: none;
    color: #e06c75;
    font-size: 12px;
}

#lock-btn {
    background: none;
    border: none;
    color: #555;
    cursor: pointer;
    padding: 8px 12px;
    font-size: 14px;
}

#lock-btn:hover { color: #d4d4d4; }

/* ── Tabs ─────────────────────────────────────────────────────────────────── */

#tab-bar {
    display: flex;
    gap: 0;
    background: #252526;
    border-bottom: 1px solid #1e1e1e;
    flex-shrink: 0;
    padding: 0 8px;
}

.tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: #888;
    padding: 8px 16px;
    cursor: pointer;
    font-family: inherit;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.tab-btn:hover {
    color: #d4d4d4;
}

.tab-btn.active {
    color: #d4d4d4;
    border-bottom-color: #007acc;
}

.tab-section {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

/* ── Explorer layout ──────────────────────────────────────────────────────── */

#explorer-layout {
    display: flex;
    flex: 1;
    overflow: hidden;
}

#file-tree-panel {
    width: 240px;
    min-width: 160px;
    background: #252526;
    border-right: 1px solid #1e1e1e;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    flex-shrink: 0;
}

#tree-header {
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 0.1em;
    color: #bbb;
    padding: 10px 12px 6px;
    flex-shrink: 0;
}

#file-tree {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ── Upload dropzone ─────────────────────────────────────────────────────── */

#upload-dropzone {
    flex-shrink: 0;
    margin: 8px;
    padding: 8px;
    border: 1px dashed #444;
    border-radius: 4px;
    color: #666;
    font-size: 11px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}

#upload-dropzone:hover {
    border-color: #666;
    color: #999;
}

#upload-dropzone.dragover {
    border-color: #58a6ff;
    color: #58a6ff;
}

/* ── Tree items ───────────────────────────────────────────────────────────── */

.tree-item {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px 2px 0;
    cursor: pointer;
    white-space: nowrap;
    position: relative;
    user-select: none;
}

.tree-item:hover {
    background: #2a2d2e;
}

.tree-item.active {
    background: #37373d;
}

.tree-arrow {
    width: 16px;
    text-align: center;
    color: #888;
    font-size: 10px;
    flex-shrink: 0;
}

.tree-icon {
    flex-shrink: 0;
    font-size: 14px;
}

.tree-icon.folder { color: #e8ab53; }
.tree-icon.folder-open { color: #e8ab53; }
.tree-icon.file-py { color: #3572a5; }
.tree-icon.file-js { color: #f1e05a; }
.tree-icon.file-ts { color: #3178c6; }
.tree-icon.file-html { color: #e34c26; }
.tree-icon.file-css { color: #563d7c; }
.tree-icon.file-json { color: #cbcb41; }
.tree-icon.file-md { color: #083fa1; }
.tree-icon.file-yml { color: #cb171e; }
.tree-icon.file-sh { color: #89e051; }
.tree-icon.file-default { color: #888; }

.tree-label {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
}

.tree-delete-btn {
    display: none;
    background: none;
    border: none;
    color: #e06c75;
    cursor: pointer;
    padding: 0 6px;
    font-size: 14px;
    line-height: 1;
    flex-shrink: 0;
}

.tree-item:hover .tree-delete-btn {
    display: block;
}

.tree-delete-btn:hover {
    color: #ff4444;
}

/* ── Editor panel ─────────────────────────────────────────────────────────── */

#editor-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
}

#editor-empty {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #555;
    gap: 12px;
}

#editor-empty .codicon {
    font-size: 48px;
}

#editor-empty p {
    font-size: 13px;
}

#editor-container {
    display: none;
    flex: 1;
    flex-direction: column;
    overflow: hidden;
}

#editor-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: #2d2d2d;
    border-bottom: 1px solid #1e1e1e;
    flex-shrink: 0;
}

#editor-file-icon {
    color: #888;
    font-size: 14px;
}

#editor-filename {
    color: #d4d4d4;
    font-size: 13px;
}

#save-btn, #close-btn {
    padding: 3px 12px;
    border-radius: 2px;
    cursor: pointer;
    border: none;
    font-size: 12px;
    font-family: inherit;
}

#save-btn {
    background: #0e639c;
    color: #fff;
}

#save-btn:hover { background: #1177bb; }

#close-btn {
    background: #3a3a3a;
    color: #d4d4d4;
}

#close-btn:hover { background: #4a4a4a; }

#editor {
    flex: 1;
    min-height: 0;
}

#status-msg {
    padding: 4px 12px;
    font-size: 12px;
    color: #98c379;
    background: #252526;
    min-height: 24px;
    flex-shrink: 0;
}

#status-msg.error { color: #e06c75; }

/* ── Docker dashboard ─────────────────────────────────────────────────────── */

#tab-docker {
    overflow-y: auto;
    padding: 16px;
}

.docker-section {
    margin-bottom: 32px;
}

.docker-section h2 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
    margin-bottom: 10px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 10px;
}

.section-header h2 { margin-bottom: 0; }

#refresh-docker-btn, #delete-unused-btn {
    background: none;
    border: 1px solid #555;
    color: #888;
    padding: 2px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
}

#refresh-docker-btn:hover {
    color: #d4d4d4;
    border-color: #888;
}

#delete-unused-btn:hover {
    color: #e06c75;
    border-color: #e06c75;
}

.filter-btns {
    display: flex;
    gap: 4px;
}

.filter-btn {
    background: none;
    border: 1px solid transparent;
    color: #888;
    padding: 2px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
}

.filter-btn:hover { color: #d4d4d4; }

.filter-btn.active {
    border-color: #555;
    color: #d4d4d4;
    background: #2a2d2e;
}

.container-card, .network-card, .image-card {
    background: #252526;
    border-radius: 4px;
    padding: 10px 14px;
    margin-bottom: 4px;
}

.card-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.card-name {
    flex: 1;
    color: #d4d4d4;
    font-weight: bold;
}

.card-meta {
    color: #888;
    font-size: 12px;
}

.status-badge {
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: bold;
}

.status-badge.running {
    background: #1a3a1a;
    color: #98c379;
    border: 1px solid #98c379;
}

.status-badge.stopped {
    background: #2a2a2a;
    color: #888;
    border: 1px solid #555;
}

.action-btn {
    background: none;
    border: 1px solid #555;
    color: #d4d4d4;
    padding: 2px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
}

.action-btn:hover { background: #3a3a3a; }
.action-btn.start:hover { border-color: #98c379; color: #98c379; }
.action-btn.stop:hover { border-color: #e06c75; color: #e06c75; }
.action-btn.restart:hover { border-color: #e5c07b; color: #e5c07b; }
.action-btn.logs:hover { border-color: #569cd6; color: #569cd6; }

/* ── Cheat sheet ──────────────────────────────────────────────────────────── */

.cheatsheet {
    overflow-y: auto;
    padding: 20px;
}

.cs-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(360px, 1fr));
    gap: 16px;
    align-items: start;
}

.cs-section {
    background: #252526;
    border: 1px solid #3a3a3a;
    border-radius: 6px;
    overflow: hidden;
}

.cs-section h2 {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.09em;
    color: #9cdcfe;
    background: #1e1e1e;
    border-bottom: 1px solid #3a3a3a;
    margin: 0;
    padding: 10px 14px;
}

.cs-group {
    display: flex;
    flex-direction: column;
    padding: 10px 14px;
    gap: 0;
}

.cs-entry {
    border-bottom: 1px solid #2d2d2d;
    padding: 8px 0;
}

.cs-entry:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.cs-entry:first-child {
    padding-top: 0;
}

.cs-label {
    font-size: 11px;
    color: #888;
    margin-bottom: 5px;
}

.cs-code {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 4px;
    padding: 7px 10px;
}

.cs-code code {
    flex: 1;
    font-family: 'Consolas', 'Courier New', monospace;
    font-size: 12px;
    color: #ce9178;
    white-space: pre;
    overflow-x: auto;
}

.copy-btn {
    background: none;
    border: 1px solid #3a3a3a;
    color: #666;
    padding: 2px 8px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 10px;
    font-family: inherit;
    flex-shrink: 0;
    transition: color 0.1s, border-color 0.1s;
}

.copy-btn:hover {
    color: #d4d4d4;
    border-color: #888;
}

/* ── Server resources ─────────────────────────────────────────────────────── */

.resource-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.resource-card {
    background: #252526;
    border-radius: 4px;
    padding: 16px;
}

.resource-label {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #555;
    margin-bottom: 8px;
}

.resource-value {
    font-size: 22px;
    color: #d4d4d4;
    margin-bottom: 10px;
}

.resource-bar {
    height: 4px;
    background: #3a3a3a;
    border-radius: 2px;
    overflow: hidden;
}

.resource-bar-fill {
    height: 100%;
    background: #007acc;
    border-radius: 2px;
    transition: width 0.5s ease;
    width: 0%;
}

/* ── Logs panel ───────────────────────────────────────────────────────────── */

.logs-panel {
    display: none;
    margin-top: 10px;
    background: #111;
    color: #98c379;
    padding: 10px;
    font-size: 12px;
    max-height: 300px;
    overflow-y: auto;
    white-space: pre-wrap;
    border-radius: 3px;
    border: 1px solid #333;
}

/* ── Terminal ─────────────────────────────────────────────────────────────── */

#tab-terminal {
    flex: 1;
    padding: 16px;
    overflow: hidden;
}

#terminal-container {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid #30363d;
}
