body {
    margin: 0;
    font-family: sans-serif;
    background: #f5f5f5;
    color: #111;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    background: #222;
    color: #fff;
}

.topbar a {
    color: #fff;
    text-decoration: none;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page {
    padding: 20px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.actions {
    display: flex;
    gap: 8px;
}

.card {
    background: #fff;
    border: 1px solid #ddd;
    padding: 16px;
}

.form {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 720px;
}

.form input[type="text"],
.form input[type="password"],
.form input[type="number"] {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
}

.login-page .card {
    width: 360px;
}

.error {
    color: #b00020;
    font-size: 14px;
}

.button,
button {
    display: inline-block;
    padding: 8px 12px;
    border: 1px solid #222;
    background: #222;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

.button.secondary {
    background: #fff;
    color: #222;
}

.button.danger,
button.danger {
    background: #b00020;
    border-color: #b00020;
    color: #fff;
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: left;
    vertical-align: top;
}

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.notice {
    padding: 12px;
    margin-bottom: 16px;
    border: 1px solid #ddd;
    background: #fff;
}

.notice.success {
    border-color: #5a9b68;
    background: #eef9f0;
}

.notice.error {
    border-color: #b00020;
    background: #fff1f3;
}

.meta-grid {
    display: grid;
    gap: 10px;
    margin-bottom: 16px;
}

.log-box {
    min-height: 400px;
    max-height: 70vh;
    overflow: auto;
    background: #111;
    color: #eee;
    padding: 12px;
    white-space: pre-wrap;
}

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

.status-badge {
    display: inline-block;
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 999px;
    font-size: 12px;
    text-transform: lowercase;
    background: #f4f4f4;
}

.status-badge.success,
.status-badge.enabled {
    background: #eef9f0;
    border-color: #5a9b68;
}

.status-badge.disabled {
    background: #f0f0f0;
    border-color: #999;
}

.status-badge.warning {
    background: #fff6df;
    border-color: #c99a00;
}

.status-badge.failed,
.status-badge.cancelled,
.status-badge.timeout,
.status-badge.system_error {
    background: #fff1f3;
    border-color: #b00020;
}

.status-badge.running,
.status-badge.starting,
.status-badge.queued,
.status-badge.cancel_requested {
    background: #eef4ff;
    border-color: #4676d7;
}

.status-badge.interrupted {
    background: #7f1d1d;
    color: #fee2e2;
}

.status-badge.waiting_for_lock {
    background: #eef4ff;
    border-color: #4676d7;
}

.form select {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

.status-badge.waiting_for_lock {
    background: #eef4ff;
    border-color: #4676d7;
}

.form textarea {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    resize: vertical;
}

.form-section {
    border: 1px solid #ddd;
    padding: 12px;
    background: #fafafa;
}

.form-section h2 {
    margin-top: 0;
    font-size: 16px;
}

.help-text {
    margin-top: 0;
    color: #555;
    font-size: 14px;
}

.runs-filter-card {
    margin-bottom: 12px;
}

.filter-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 12px;
    align-items: end;
}

.filter-form label {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 14px;
}

.filter-form select {
    width: 100%;
    padding: 8px;
    box-sizing: border-box;
}

.filter-actions {
    display: flex;
    gap: 8px;
}

.list-summary {
    margin: 12px 0;
    color: #555;
    font-size: 14px;
}

.pagination {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin: 12px 0;
}

.page-links {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex-wrap: wrap;
}

.page-gap {
    padding: 8px 4px;
}

.current-page {
    cursor: default;
}

.disabled-button {
    opacity: 0.45;
    cursor: default;
}

.table-scroll {
    overflow-x: auto;
}

.deleted-section + .deleted-section {
    margin-top: 16px;
}

.deleted-section h2 {
    margin-top: 0;
}
