:root {
    --bg:         #fafaf7;
    --fg:         #1c1c1c;
    --muted:      #777;
    --accent:     #2a6df4;
    --border:     #e6e3dc;
    --code-bg:    #f1efe8;
    --row-hover:  #f1efe8;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
    color: var(--fg);
    background: var(--bg);
    line-height: 1.55;
}

header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 24px;
    border-bottom: 1px solid var(--border);
    background: white;
}

header h1 { font-size: 18px; margin: 0; font-weight: 600; }

#header-right { display: flex; align-items: center; gap: 16px; }
#user { font-size: 13px; color: var(--muted); }
#user .signout { margin-left: 8px; color: var(--accent); cursor: pointer; }

#run-btn {
    background: var(--accent);
    color: white;
    border: 0;
    border-radius: 6px;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
}
#run-btn:hover { filter: brightness(1.05); }
#run-btn:disabled { background: #aaa; cursor: not-allowed; }

#run-status {
    margin-bottom: 20px;
    padding: 12px;
    border-radius: 6px;
    background: var(--code-bg);
    font-size: 12px;
}
#run-status h2 { margin-top: 0; }
#run-status .row {
    display: flex;
    justify-content: space-between;
    margin-top: 6px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
}
#run-status .badge {
    display: inline-block;
    padding: 1px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    background: #ddd;
}
#run-status .badge.in_progress, #run-status .badge.queued { background: #ffd76b; color: #4a3500; }
#run-status .badge.success { background: #b6e3b6; color: #1a4d1a; }
#run-status .badge.failure, #run-status .badge.cancelled, #run-status .badge.timed_out { background: #f0b4b4; color: #4a1a1a; }

dialog#run-dialog {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0;
    width: min(520px, 92vw);
    box-shadow: 0 10px 30px rgba(0,0,0,0.18);
}
dialog#run-dialog::backdrop { background: rgba(0,0,0,0.32); }
dialog#run-dialog #run-form { padding: 20px 24px; }
dialog#run-dialog h3 { margin: 0 0 14px; font-size: 16px; }
dialog#run-dialog label { display: block; margin-bottom: 14px; font-size: 13px; color: var(--muted); }
dialog#run-dialog label.inline { display: flex; gap: 8px; align-items: center; color: var(--fg); }
dialog#run-dialog select {
    display: block;
    margin-top: 4px;
    width: 100%;
    padding: 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: white;
}
dialog#run-dialog .actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 8px;
}
dialog#run-dialog button {
    padding: 7px 16px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: white;
    font-size: 13px;
    cursor: pointer;
}
dialog#run-dialog button.primary { background: var(--accent); color: white; border-color: var(--accent); }
dialog#run-dialog button.secondary { background: white; }

main {
    display: grid;
    grid-template-columns: 320px 1fr;
    height: calc(100vh - 53px);
}

aside {
    border-right: 1px solid var(--border);
    overflow-y: auto;
    padding: 16px;
    background: white;
}

aside h2 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); margin: 0 0 10px; }

#run-list { list-style: none; padding: 0; margin: 0; }
#run-list li {
    padding: 10px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-family: ui-monospace, "SF Mono", Menlo, monospace;
    color: var(--fg);
    border: 1px solid transparent;
}
#run-list li:hover { background: var(--row-hover); }
#run-list li.active {
    background: var(--row-hover);
    border-color: var(--border);
    font-weight: 600;
}
#run-list .size { color: var(--muted); font-size: 11px; margin-left: 6px; }

article#viewer {
    overflow-y: auto;
    padding: 32px 48px;
    max-width: 980px;
}

article#viewer h1 { font-size: 24px; margin-top: 0; }
article#viewer h2 { font-size: 18px; margin-top: 28px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
article#viewer h3 { font-size: 15px; margin-top: 22px; }

article#viewer table {
    border-collapse: collapse;
    width: 100%;
    margin: 16px 0;
    font-size: 13px;
}
article#viewer th, article#viewer td {
    border: 1px solid var(--border);
    padding: 6px 10px;
    text-align: left;
}
article#viewer th { background: var(--code-bg); font-weight: 600; }

article#viewer code {
    background: var(--code-bg);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.92em;
}
article#viewer pre {
    background: var(--code-bg);
    padding: 12px 16px;
    border-radius: 6px;
    overflow-x: auto;
}
article#viewer pre code { background: none; padding: 0; }

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