:root { color-scheme: dark; }
* { box-sizing: border-box; }
body { margin: 0; font: 14px/1.4 -apple-system, Segoe UI, Roboto, Arial, sans-serif; background: #0f1115; color: #e6e6e6; }
header { position: sticky; top: 0; z-index: 3; padding: 12px 20px; background: #171a21; border-bottom: 1px solid #2a2f3a; display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
h1 { font-size: 16px; margin: 0; font-weight: 600; }
h2 { font-size: 14px; margin: 0; font-weight: 600; color: #b9c0cc; }
.nav { display: flex; gap: 4px; }
.nav a { color: #8b93a3; text-decoration: none; font-size: 13px; padding: 3px 10px; border-radius: 6px; }
.nav a:hover { color: #e6e6e6; background: #22262f; }
.nav a.active { color: #e6e6e6; background: #2a2f3a; }
.spacer { flex: 1; }
.tabs { display: flex; gap: 2px; padding: 10px 20px 0; border-bottom: 1px solid #2a2f3a; background: #0f1115; }
.tab { padding: 8px 14px; cursor: pointer; color: #8b93a3; border: 1px solid transparent; border-bottom: none; border-radius: 6px 6px 0 0; font-size: 13px; }
.tab.active { color: #e6e6e6; background: #171a21; border-color: #2a2f3a; }
main { padding: 16px 20px 60px; }
section { display: none; }
section.active { display: block; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 8px 0 12px; }
.toolbar .grow { flex: 1; }
button, .btn { background: #22262f; color: #e6e6e6; border: 1px solid #2a2f3a; border-radius: 6px; padding: 5px 10px; font-size: 12.5px; cursor: pointer; white-space: nowrap; }
button:hover { background: #2a2f3a; }
button.primary { background: #1f3b5c; border-color: #2c5687; color: #cfe6ff; }
button.primary:hover { background: #26507f; }
button.danger { color: #ff8b97; }
button.danger:hover { background: #3a161c; }
button.sm { padding: 2px 7px; font-size: 11.5px; }
button:disabled { opacity: .5; cursor: default; }
select, input, textarea { background: #0f1115; color: #e6e6e6; border: 1px solid #2a2f3a; border-radius: 6px; padding: 5px 8px; font: inherit; font-size: 13px; }
input[type=checkbox] { width: 16px; height: 16px; }
textarea { min-height: 70px; font-family: Consolas, monospace; font-size: 12px; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; padding: 7px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #8b93a3; border-bottom: 1px solid #2a2f3a; white-space: nowrap; }
td { padding: 6px 10px; border-bottom: 1px solid #1c2027; vertical-align: top; }
tr.selected td { background: rgba(108,182,255,.08); }
tr.clickable { cursor: pointer; }
tr.clickable:hover td { background: rgba(255,255,255,.03); }
tr.disabled td { color: #6f7785; }
tr.final-step td { background: #12151b; }
tr.final-step.first td { border-top: 2px solid #2a2f3a; }
.badge.step { background: #2a2338; color: #c9a7ff; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: #8b93a3; }
.mono { font-family: Consolas, monospace; font-size: 12px; }
.wrap { overflow-wrap: anywhere; }
.actions { white-space: nowrap; }
.actions button { margin-right: 4px; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; }
.badge.success, .badge.on { background: #16361f; color: #5bd97f; }
.badge.error { background: #3a161c; color: #ff6b7a; }
.badge.running { background: #16273a; color: #6cb6ff; animation: fb-pulse 1.2s ease-in-out infinite; }
.badge.off { background: #23262d; color: #9aa3b2; }
@keyframes fb-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }
.card { background: #14171d; border: 1px solid #2a2f3a; border-radius: 8px; padding: 12px 14px; margin-top: 14px; }
.card h3 { margin: 0 0 8px; font-size: 13px; color: #b9c0cc; font-weight: 600; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 1000px) { .grid2 { grid-template-columns: 1fr; } }
.scroll { overflow: auto; max-height: 60vh; border: 1px solid #1c2027; border-radius: 6px; }
.scroll table { min-width: 100%; }
.scroll td, .scroll th { white-space: nowrap; max-width: 380px; overflow: hidden; text-overflow: ellipsis; }
.scroll th { text-transform: none; letter-spacing: 0; font-size: 12px; }
pre { background: #0f1115; border: 1px solid #1c2027; border-radius: 6px; padding: 10px; font-size: 12px; overflow: auto; margin: 6px 0; max-height: 50vh; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; font-size: 13px; }
.kv div:nth-child(odd) { color: #8b93a3; }
.diff-miss { color: #ff8b97; }
.diff-extra { color: #ffcc66; }
.notes li { margin: 2px 0; color: #b9c0cc; }
.toast-wrap { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 10; }
.toast { background: #22262f; border: 1px solid #2a2f3a; border-left: 4px solid #6cb6ff; padding: 10px 14px; border-radius: 6px; font-size: 13px; max-width: 420px; box-shadow: 0 4px 18px rgba(0,0,0,.4); }
.toast.error { border-left-color: #ff6b7a; }
.toast.ok { border-left-color: #5bd97f; }
.toast a { color: #6cb6ff; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: none; align-items: flex-start; justify-content: center; z-index: 20; padding: 40px 16px; overflow: auto; }
.modal-bg.open { display: flex; }
.modal { background: #171a21; border: 1px solid #2a2f3a; border-radius: 10px; width: min(760px, 100%); padding: 18px 20px; }
.modal h3 { margin: 0 0 12px; font-size: 15px; }
.form { display: grid; grid-template-columns: 200px 1fr; gap: 8px 12px; align-items: center; }
.form label { color: #b9c0cc; font-size: 13px; }
.form label small { display: block; color: #6f7785; font-size: 11px; }
.form input[type=text], .form input[type=number], .form input[type=password], .form textarea, .form select { width: 100%; }
.form .full { grid-column: 1 / -1; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.empty { padding: 20px; text-align: center; color: #8b93a3; }
.inline-tabs { display: flex; gap: 4px; margin: 6px 0; }
.inline-tabs button.active { background: #2a2f3a; }
code { background: #22262f; padding: 0 5px; border-radius: 4px; font-size: 12px; }
.form textarea[data-col="SourceSql"], .form textarea[data-col="SqlText"] { min-height: 220px; }
.map-grid input[type=text] { width: 100%; font-family: Consolas, monospace; font-size: 12px; padding: 3px 6px; }
.map-grid td { padding: 4px 8px; vertical-align: middle; }
.map-grid tr.req-missing td:first-child { color: #ff8b97; }
.map-grid .sample { color: #8b93a3; font-size: 12px; max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge.req { background: #3a2a16; color: #ffb366; }
.err-list li { color: #ff8b97; } .warn-list li { color: #ffcc66; }

/* schedules timeline */
.timeline { margin: 4px 0 14px; background: #14171d; border: 1px solid #2a2f3a; border-radius: 8px; padding: 10px 0 4px; overflow: hidden; }
.timeline:empty { display: none; }
.tl-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 0 12px 4px; }
.tl-legend { font-size: 11.5px; color: #8b93a3; display: flex; align-items: center; gap: 4px; }
.tl-legend .lg { display: inline-block; width: 14px; height: 8px; border-radius: 2px; margin-left: 8px; }
.lg.planned { background: #22262f; border: 1px solid #4a5160; }
.lg.running { background: #6cb6ff; }
.lg.success { background: #2f7d46; }
.lg.error { background: #a33a48; }
.lg.norun { border: 1px dashed #6f7785; }
.timeline svg { display: block; font: 11.5px -apple-system, Segoe UI, Roboto, Arial, sans-serif; }
.tl-axis { stroke: #4a5160; stroke-width: 1.5; }
.tl-grid { stroke: #1f232b; }
.tl-hour { fill: #8b93a3; font-size: 11px; text-anchor: middle; }
.tl-label polyline { fill: none; stroke: #3a4050; }
.tl-label text { fill: #e6e6e6; }
.tl-label .tm { fill: #8b93a3; font-variant-numeric: tabular-nums; }
.tl-label.past text { fill: #8b93a3; }
.tl-label.past .tm { fill: #6f7785; }
.tl-label.running text, .tl-label.running .tm { fill: #6cb6ff; font-weight: 600; }
.tl-label.hl text, .tl-label.hl .tm { fill: #fff; }
.tl-label.hl polyline { stroke: #9ad1ff; }

.tl-bar rect { stroke-width: 1; }
.tl-bar text { fill: #b9c0cc; font-size: 10.5px; }
.tl-bar text[data-in] { fill: #e6e6e6; }
.tl-bar.planned rect { fill: #22262f; stroke: #4a5160; }
.tl-bar.success rect { fill: #2f7d46; stroke: #2f7d46; }
.tl-bar.error rect { fill: #a33a48; stroke: #a33a48; }
.tl-bar.other rect { fill: #3a4050; stroke: #3a4050; }
.tl-bar.norun rect { fill: none; stroke: #6f7785; stroke-dasharray: 3 2; }
.tl-bar.norun text { fill: #6f7785; }
.tl-bar.running .exp { fill: #16273a; stroke: #2c5687; }
.tl-bar.running .fill { fill: #6cb6ff; stroke: none; }
.tl-bar.running .over { fill: #ffcc66; stroke: none; opacity: .85; }
.tl-bar.running .pct { fill: #6cb6ff; font-weight: 600; }
.tl-bar.hl rect { stroke: #fff; }
.tl-bar.hl text { fill: #fff; }
.tl-now { stroke: #ff6b7a; stroke-width: 1.5; }
.tl-now-t { fill: #ff6b7a; font-size: 11px; font-weight: 600; }
.tl-pool + .tl-pool { border-top: 1px solid #2a2f3a; margin-top: 4px; padding-top: 8px; }
.tl-pool h3 { margin: 4px 12px 0; font-size: 12.5px; color: #b9c0cc; font-weight: 600; }
.tl-bar, .tl-label { cursor: pointer; }
.tl-label .nm:hover { text-decoration: underline; }

/* header: running jobs with progress */
#inflight { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 12px; }
.hdr-run { display: inline-flex; align-items: center; gap: 7px; color: #6cb6ff; text-decoration: none; white-space: nowrap; }
.hdr-run b { color: #e6e6e6; font-weight: 600; }
.hdr-run:hover b { text-decoration: underline; }
.pbar { position: relative; display: inline-block; width: 120px; height: 8px; border-radius: 4px; background: #16273a; border: 1px solid #2c5687; overflow: hidden; }
.pbar i { position: absolute; left: 0; top: 0; bottom: 0; background: #6cb6ff; transition: width .6s linear; }
.hdr-run.over { color: #ffcc66; }
.hdr-run.over .pbar { border-color: #8a6a2a; }
.hdr-run.over .pbar i { background: #ffcc66; }
.pbar.unknown i { width: 30%; animation: pbar-slide 1.4s ease-in-out infinite; }
@keyframes pbar-slide { from { left: -30%; } to { left: 100%; } }
.tl-bar.running .fill.slow { fill: #ffcc66; }
