:root {
    color-scheme: dark;
    --bg: #0c0f14;
    --panel: #151a22;
    --panel-2: #1b222c;
    --line: #2b3442;
    --text: #edf2f7;
    --muted: #9aa7b7;
    --accent: #44c08a;
    --danger: #ff6b6b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.4 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
    font: inherit;
}

button {
    border: 1px solid var(--line);
    background: var(--panel-2);
    color: var(--text);
    border-radius: 6px;
    padding: 8px 12px;
    cursor: pointer;
}

button:hover {
    border-color: var(--accent);
}

button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

input,
select {
    width: 100%;
    border: 1px solid var(--line);
    background: #0f131a;
    color: var(--text);
    border-radius: 6px;
    padding: 8px 10px;
}

.hidden {
    display: none !important;
}

.shell {
    min-height: 100vh;
}

.auth-panel {
    width: min(420px, calc(100vw - 32px));
    margin: 16vh auto 0;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
}

.auth-panel h1,
header h1 {
    margin: 0;
    font-size: 24px;
}

.auth-panel p,
header p {
    margin: 6px 0 0;
    color: var(--muted);
}

.setup-fields {
    margin: 18px 0 12px;
}

.setup-fields label {
    display: block;
    margin-bottom: 6px;
    color: var(--muted);
}

.auth-actions {
    margin-top: 18px;
    display: flex;
    gap: 10px;
}

.error {
    min-height: 20px;
    color: var(--danger) !important;
}

.app {
    display: grid;
    grid-template-rows: auto auto 1fr;
    min-height: 100vh;
}

header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
    background: var(--panel);
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

nav {
    display: flex;
    gap: 8px;
    padding: 10px 20px;
    border-bottom: 1px solid var(--line);
    background: #10151c;
}

.tab.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #07120d;
}

.tab-panel {
    display: none;
    min-height: 0;
    padding: 16px 20px 20px;
}

.tab-panel.active {
    display: block;
}

#terminal,
#logs {
    padding: 0;
}

#terminal-view {
    width: 100%;
    height: calc(100vh - 123px);
    padding: 10px;
    background: #05070a;
}

#logs-view {
    height: calc(100vh - 169px);
    margin: 0;
    padding: 14px;
    overflow: auto;
    white-space: pre-wrap;
    background: #05070a;
    color: #d5dde8;
}

.logs-toolbar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 46px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--line);
    background: #10151c;
}

#restart-status {
    color: var(--muted);
}

.toolbar {
    margin-bottom: 14px;
}

.apps-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 12px;
}

.app-card,
.process-card {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 14px;
}

.app-card h2 {
    margin: 0 0 8px;
    font-size: 18px;
}

.meta {
    color: var(--muted);
    font-size: 13px;
}

.upload-form {
    display: grid;
    gap: 10px;
    margin-top: 12px;
}

.old-list {
    margin-top: 12px;
    max-height: 150px;
    overflow: auto;
    border-top: 1px solid var(--line);
    padding-top: 8px;
}

.old-list div {
    color: var(--muted);
    font-size: 12px;
    padding: 2px 0;
}

.processes-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 12px;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: #293241;
    color: var(--muted);
    font-size: 12px;
}

.status-pill.ok {
    background: rgba(68, 192, 138, .16);
    color: var(--accent);
}

.status-pill.bad {
    background: rgba(255, 107, 107, .16);
    color: var(--danger);
}
