:root {
    color-scheme: dark;
    --background: #090e17;
    --panel: #111a29;
    --border: #243247;
    --text: #edf2fa;
    --muted: #91a1b8;
    --accent: #38bdf8;
    --danger: #dc3545;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--background);
    color: var(--text);
    font: 14px system-ui, sans-serif;
    display: grid;
    grid-template-columns: 245px minmax(0,1fr);
    min-height: 100vh;
}

aside {
    background: var(--panel);
    border-right: 1px solid var(--border);
    padding: 24px 16px;
}

h1 { font-size: 30px; margin: 0; }
h1 span { color: var(--accent); }
h2 { margin: 0 0 12px; }
.muted, #connection { color: var(--muted); }

nav {
    display: grid;
    gap: 5px;
    margin-top: 30px;
}

button, input, select, textarea {
    font: inherit;
    border: 1px solid var(--border);
    border-radius: 7px;
    padding: 11px 14px;
    background: var(--panel);
    color: var(--text);
}

button { cursor: pointer; }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .5; cursor: default; }

nav button {
    text-align: left;
    background: transparent;
    border-color: transparent;
}

nav button.active {
    background: #193047;
    color: var(--accent);
}

main { padding: 28px; min-width: 0; }

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 15px;
    margin-bottom: 28px;
}

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.danger { background: var(--danger); }

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit,minmax(180px,1fr));
    gap: 15px;
}

.card, #login, form.editor {
    padding: 22px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.card strong {
    display: block;
    font-size: 29px;
    margin-top: 12px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 9px;
}

table {
    width: 100%;
    border-collapse: collapse;
    background: var(--panel);
}

th, td {
    padding: 13px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    max-width: 350px;
    overflow-wrap: anywhere;
}

th { color: var(--muted); }
footer { margin-top: 40px; color: var(--muted); }
#notice { margin: 15px 0; color: var(--accent); }
#controls { margin-bottom: 20px; }

form.editor {
    display: grid;
    gap: 12px;
    max-width: 850px;
}

textarea { min-height: 100px; resize: vertical; }
[hidden] { display: none !important; }

@media(max-width:800px) {
    body { display: block; }
    aside { border-right: 0; }
    nav { grid-template-columns: repeat(2,1fr); }
    main { padding: 16px; }
    header { align-items: flex-start; flex-direction: column; }
}

/* Global readability improvements */

.positive {
    color: #4ade80;
    font-weight: 600;
}

.neutral {
    color: #94a3b8;
}

.status-value {
    font-weight: 600;
}

.status-value[data-status="completed"],
.status-value[data-status="successful"],
.status-value[data-status="approved"],
.status-value[data-status="active"] {
    color: #4ade80;
}

.status-value[data-status="failed"],
.status-value[data-status="rejected"],
.status-value[data-status="blocked"] {
    color: #f87171;
}

.status-value[data-status="queued"],
.status-value[data-status="pending"],
.status-value[data-status="awaiting_coding"] {
    color: #fbbf24;
}

.status-value[data-status="planning"],
.status-value[data-status="coding"],
.status-value[data-status="reviewing"],
.status-value[data-status="deploying"] {
    color: #38bdf8;
}

.date-value {
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.technical-value {
    font-family: ui-monospace, monospace;
    font-size: 12px;
}

table {
    min-width: max-content;
}

th {
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .2px;
}

td {
    vertical-align: middle;
    min-width: 90px;
}

.table-wrap {
    max-width: 100%;
}

@media(min-width:801px) {
    aside {
        position: sticky;
        top: 0;
        height: 100vh;
        overflow-y: auto;
    }
}

@media(max-width:800px) {
    aside {
        padding: 16px;
    }

    aside h1 {
        font-size: 24px;
    }

    nav {
        display: flex;
        overflow-x: auto;
        gap: 6px;
        margin-top: 16px;
        padding-bottom: 8px;
    }

    nav button {
        flex-shrink: 0;
        white-space: nowrap;
    }

    aside footer {
        display: none;
    }

    main {
        padding: 16px;
    }

    table {
        font-size: 13px;
    }
}

.agent-run {
    padding: 16px;
    margin: 12px 0;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--background);
}

.agent-run p {
    margin: 6px 0;
    color: var(--muted);
}

#controls .card {
    overflow-x: auto;
}

#controls table {
    min-width: 0;
}

#controls h3 {
    margin-top: 25px;
    color: var(--accent);
}

#controls h4 {
    margin-bottom: 8px;
}

#controls li {
    line-height: 1.8;
}

#controls .card button {
    margin: 8px 8px 8px 0;
}

tbody tr:hover {
    background: #192638;
}

