:root {
    color-scheme: light;
    --bg: #f3f6fa;
    --card: #ffffff;
    --text: #172033;
    --muted: #64748b;
    --line: #dbe3ee;
    --primary: #1d4ed8;
    --primary-hover: #1e40af;
    --danger: #b91c1c;
    --success: #047857;
    --warning: #b45309;
    --radius: 12px;
}
* { box-sizing: border-box; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 15px;
    line-height: 1.45;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: min(1180px, calc(100% - 32px)); margin: 0 auto; }
.topbar { background: #0f172a; color: #fff; box-shadow: 0 2px 12px rgba(15,23,42,.18); }
.topbar-inner { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.brand { color: #fff; font-weight: 750; letter-spacing: .01em; }
.brand:hover { text-decoration: none; }
.nav { display: flex; align-items: center; gap: 18px; }
.nav a, .nav button { color: #e2e8f0; background: transparent; border: 0; cursor: pointer; font: inherit; padding: 0; }
.nav a:hover, .nav button:hover { color: #fff; text-decoration: none; }
main { padding: 30px 0 60px; }
.page-title { margin: 0 0 20px; font-size: 27px; line-height: 1.2; }
.grid { display: grid; grid-template-columns: 1fr; gap: 20px; }
.grid-two { grid-template-columns: minmax(0, 1.15fr) minmax(330px, .85fr); align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 5px 18px rgba(15,23,42,.05); }
.card-header { padding: 18px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 14px; }
.card-header h2 { margin: 0; font-size: 18px; }
.card-body { padding: 20px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; margin-bottom: 6px; font-weight: 650; }
.field small { display: block; margin-top: 5px; color: var(--muted); }
input, select, textarea {
    width: 100%; border: 1px solid #cbd5e1; border-radius: 8px; padding: 10px 11px; font: inherit; color: var(--text); background: #fff;
}
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(29,78,216,.14); border-color: #3b82f6; }
.checkbox { display: flex; gap: 9px; align-items: flex-start; }
.checkbox input { width: auto; margin-top: 3px; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 7px; border: 0; border-radius: 8px; padding: 10px 15px; font: inherit; font-weight: 650; cursor: pointer; background: #e2e8f0; color: #172033; }
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-danger { background: #fee2e2; color: var(--danger); }
.btn-success { background: #dcfce7; color: var(--success); }
.btn-small { padding: 7px 10px; font-size: 13px; }
.alert { border-radius: 9px; padding: 12px 14px; margin-bottom: 18px; border: 1px solid; }
.alert-success { background: #ecfdf5; border-color: #a7f3d0; color: #065f46; }
.alert-error { background: #fef2f2; border-color: #fecaca; color: #991b1b; }
.alert-warning { background: #fffbeb; border-color: #fde68a; color: #92400e; }
.errors { margin: 6px 0 0; padding-left: 20px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: #475569; font-size: 13px; background: #f8fafc; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; border-radius: 999px; padding: 4px 9px; font-size: 12px; font-weight: 700; white-space: nowrap; background: #e2e8f0; color: #334155; }
.badge-queued { background: #e0e7ff; color: #3730a3; }
.badge-running { background: #dbeafe; color: #1d4ed8; }
.badge-completed { background: #d1fae5; color: #047857; }
.badge-failed { background: #fee2e2; color: #b91c1c; }
.badge-cancelled, .badge-cancel_requested { background: #fef3c7; color: #92400e; }
.progress { height: 12px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); transition: width .25s ease; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.log { margin: 0; max-height: 480px; overflow: auto; padding: 15px; background: #0b1220; color: #dbeafe; border-radius: 9px; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; }
.kv { display: grid; grid-template-columns: 210px minmax(0,1fr); gap: 8px 15px; }
.kv > div:nth-child(odd) { color: var(--muted); }
.login-shell { min-height: calc(100vh - 92px); display: grid; place-items: center; }
.login-card { width: min(430px, 100%); }
.pagination { margin-top: 18px; display: flex; gap: 7px; flex-wrap: wrap; }
.pagination a, .pagination span { border: 1px solid var(--line); border-radius: 7px; padding: 6px 10px; background: #fff; }
details summary { cursor: pointer; font-weight: 650; }
.inline-form { display: inline; }
@media (max-width: 880px) {
    .grid-two { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .kv { grid-template-columns: 1fr; gap: 3px; }
    .kv > div:nth-child(even) { margin-bottom: 9px; }
}
