:root {
    --ink: #1d2430;
    --text: #243041;
    --muted: #6b7686;
    --line: #e2e6ec;
    --bg: #f5f6f8;
    --card: #ffffff;
    --accent: #2f6fde;
    --accent-weak: #e8f0fd;
    --ok: #1f8a4c;
    --ok-weak: #e6f4ec;
    --warn: #a86400;
    --warn-weak: #fdf3e2;
    --bad: #c0362c;
    --bad-weak: #fbe9e7;
    --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
    font-size: 14px;
    color: var(--text);
    background: var(--bg);
}

h1 { font-size: 1.45rem; margin: 0 0 .25rem; font-weight: 650; }
h2 { font-size: 1.05rem; margin: 0; font-weight: 650; }
h3 { font-size: .95rem; margin: 0 0 .5rem; font-weight: 650; }
a { color: var(--accent); }
code, .mono { font-family: Consolas, "Cascadia Mono", monospace; font-size: .85em; }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); }
.crumbs { color: var(--muted); font-size: .85rem; margin-bottom: .35rem; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--accent); }

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 1.25rem;
}
.card-head {
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .85rem 1.1rem; border-bottom: 1px solid var(--line);
}
.card-head .hint { color: var(--muted); font-size: .85rem; }
.card-body { padding: 1rem 1.1rem; }

.grid-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .9rem 1.1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; }
.field > span { font-size: .8rem; font-weight: 600; color: var(--muted); }
.field small { color: var(--muted); font-size: .78rem; }
.field.wide { grid-column: 1 / -1; }
.check { display: flex; align-items: center; gap: .45rem; font-size: .9rem; }

input[type=text], input[type=email], input[type=password], input[type=number], input:not([type]), select, textarea {
    font: inherit; color: inherit;
    padding: .45rem .6rem;
    border: 1px solid #cfd5de; border-radius: 7px; background: #fff; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-weak); border-color: var(--accent); }
input.invalid, select.invalid { border-color: var(--bad); }
textarea.xml { min-height: 460px; font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; line-height: 1.45; }

.btn {
    font: inherit; font-weight: 600; cursor: pointer;
    padding: .45rem .9rem; border-radius: 7px; border: 1px solid #cfd5de; background: #fff; color: var(--text);
    display: inline-flex; align-items: center; gap: .4rem; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #b6bfcc; background: #fafbfc; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #255fc4; }
.btn.danger { color: var(--bad); }
.btn.small { padding: .25rem .55rem; font-size: .82rem; }
.btn.icon { padding: .25rem .45rem; }
.actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }

table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: .55rem .75rem; border-bottom: 1px solid var(--line); }
table.list td { padding: .6rem .75rem; border-bottom: 1px solid #eef1f4; vertical-align: middle; }
table.list tr:last-child td { border-bottom: none; }
table.list tr.clickable { cursor: pointer; }
table.list tr.clickable:hover td { background: #f8fafc; }
.empty { color: var(--muted); padding: 1.2rem; text-align: center; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: 999px; font-size: .75rem; font-weight: 600; background: #eef1f5; color: var(--muted); }
.badge.ok { background: var(--ok-weak); color: var(--ok); }
.badge.warn { background: var(--warn-weak); color: var(--warn); }
.badge.bad { background: var(--bad-weak); color: var(--bad); }
.badge.info { background: var(--accent-weak); color: var(--accent); }

.alert { padding: .65rem .9rem; border-radius: 8px; margin-bottom: 1rem; border: 1px solid; }
.alert.ok { background: var(--ok-weak); border-color: #bfe3cd; color: #17663a; }
.alert.bad { background: var(--bad-weak); border-color: #f2c4be; color: #8f241c; }
.alert.warn { background: var(--warn-weak); border-color: #f0d6a8; color: #7a4a00; }
.alert ul { margin: .3rem 0 0 1.1rem; padding: 0; }

.muted { color: var(--muted); }
.spacer { flex: 1; }

/* Mapping editor */
.tabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); padding: 0 1.1rem; }
.tabs button { font: inherit; background: none; border: none; padding: .7rem .8rem; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }

.map-head, .map-row {
    display: grid;
    grid-template-columns: minmax(220px, 1.25fr) 28px minmax(200px, 1fr) 92px 92px minmax(130px, .7fr) 70px;
    gap: .6rem; align-items: center;
}
.map-head { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 0 0 .45rem; border-bottom: 1px solid var(--line); }
.map-row { padding: .5rem 0; border-bottom: 1px solid #eef1f4; }
.map-row.link { background: var(--accent-weak); border-radius: 8px; padding: .55rem .6rem; margin: .6rem 0; border-bottom: none; }
.map-row .arrow { text-align: center; color: var(--muted); font-size: 1.1rem; }
.map-row .center { display: flex; justify-content: center; }
.map-row .rowbtns { display: flex; gap: .25rem; justify-content: flex-end; }
.map-row .stack { display: flex; flex-direction: column; gap: .3rem; }
.map-detail { grid-column: 1 / -1; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: .75rem; margin-top: .25rem; }
.map-detail .grid-form { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); }
.maptable { display: grid; grid-template-columns: 1fr 1fr 32px; gap: .35rem .5rem; align-items: center; margin-top: .5rem; }

.preview-table td.val { font-family: Consolas, "Cascadia Mono", monospace; font-size: .85rem; }
.next-runs { color: var(--muted); font-size: .78rem; }

.savebar {
    position: sticky; bottom: 0; z-index: 5;
    display: flex; align-items: center; gap: .75rem;
    background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
    padding: .7rem 1rem; box-shadow: 0 -6px 18px rgba(20, 30, 45, .06);
}
.dirty-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warn); display: inline-block; }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 900px) { .two-col { grid-template-columns: 1fr; } }

/* A file input inside a label styled as a button (Import on the joblist page). */
.file-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
label.btn { cursor: pointer; position: relative; }

/* Sign in */
.login-wrap { display: grid; place-items: start center; padding-top: 3rem; }
.login-card { width: 100%; max-width: 420px; }
.login-form { grid-template-columns: 1fr; }
.validation-message { color: var(--bad); font-size: .8rem; }

/* Run log */
.log-layout { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 1.25rem; align-items: start; }
@media (max-width: 900px) { .log-layout { grid-template-columns: 1fr; } }
.log-layout table.list tr.selected td { background: var(--accent-weak); }
.small-text { font-size: .78rem; }
.log-lines td { vertical-align: top; }
.log-lines tr.level-warning td { background: #fffaf0; }
.log-lines tr.level-error td, .log-lines tr.level-critical td { background: #fff5f4; }
.log-message { white-space: pre-wrap; word-break: break-word; }
.log-exception { white-space: pre-wrap; font-size: .75rem; max-height: 300px; overflow: auto; background: #f8fafc; padding: .5rem; border-radius: 6px; }

#blazor-error-ui {
    background: #fff7d6; bottom: 0; box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    display: none; left: 0; padding: 0.6rem 1.25rem 0.7rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }
