:root {
  --bg: #eef2f7;
  --bg-card: #ffffff;
  --bg-input: #f8fafc;
  --fg: #0f172a;
  --fg-muted: #64748b;
  --accent: #0369a1;
  --accent-strong: #0284c7;
  --danger: #dc2626;
  --ok: #059669;
  --warn: #d97706;
  --border: #d6dde7;
  --row-alt: #f4f7fb;
  --radius: 6px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 1px 2px rgba(15, 23, 42, .04);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--fg);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
button { background: var(--accent-strong); color: white; border: 0; padding: .5em 1em; border-radius: var(--radius); cursor: pointer; box-shadow: var(--shadow-sm); transition: filter .12s ease; }
button:hover { filter: brightness(.94); }
button.danger { background: var(--danger); }
button.link, a.link { background: transparent; color: var(--accent); border: 0; padding: 0; text-decoration: underline; cursor: pointer; box-shadow: none; }
button.link:hover { filter: none; }
input, select { background: var(--bg-input); border: 1px solid var(--border); padding: .35em .5em; border-radius: var(--radius); width: 100%; transition: border-color .12s ease, box-shadow .12s ease; }
input:focus, select:focus { outline: 0; border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(2, 132, 199, .15); }
input[type=checkbox] { width: auto; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: .75em 1em; margin-bottom: 1em; }
legend { padding: 0 .25em; font-weight: 600; color: var(--fg-muted); }
label { display: block; margin: .35em 0; }
label.checkbox { display: flex; align-items: center; gap: .5em; }
.row { display: flex; gap: .5em; align-items: stretch; }
.row > label { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; }
.row > label > input { margin-top: auto; }

header.top { display: flex; align-items: center; justify-content: space-between; background: var(--bg-card); padding: .75em 1.25em; border-bottom: 1px solid var(--border); box-shadow: var(--shadow-sm); }
header.top .brand { font-weight: 700; font-size: 1.1em; }
header.top nav { display: flex; gap: 1em; align-items: center; }
header.top form.inline { display: inline; }
.who { color: var(--fg-muted); font-size: .9em; }

main { padding: 1em 1.25em; }

.login-box { max-width: 360px; margin: 4em auto; background: var(--bg-card); padding: 2em; border-radius: var(--radius); box-shadow: var(--shadow); }
.login-box h1 { margin-top: 0; }
.login-box button { width: 100%; margin-top: .5em; }
.error { color: var(--danger); background: rgba(220,38,38,.08); border: 1px solid rgba(220,38,38,.2); padding: .5em .75em; border-radius: var(--radius); }

.list-page { display: grid; grid-template-columns: 280px 1fr; gap: 1em; }
.list-page .filter { background: var(--bg-card); padding: 1em; border-radius: var(--radius); align-self: start; position: sticky; top: 1em; max-height: calc(100vh - 5em); overflow-y: auto; box-shadow: var(--shadow); }
.list-page .filter h2 { margin-top: 0; font-size: 1em; color: var(--fg-muted); text-transform: uppercase; letter-spacing: .05em; }
.list-page .actions { display: flex; gap: .5em; align-items: center; }

.results { background: var(--bg-card); border-radius: var(--radius); padding: 1em; box-shadow: var(--shadow); }
.results-header { display: flex; justify-content: space-between; color: var(--fg-muted); margin-bottom: .5em; }

table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { text-align: left; padding: .4em .6em; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data th { color: var(--fg-muted); font-weight: 600; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tbody tr:nth-child(even) { background: var(--row-alt); }
.empty { color: var(--fg-muted); text-align: center; padding: 1em; }

.chips { display: flex; flex-wrap: wrap; gap: .3em; }
.chip { display: inline-block; padding: .1em .6em; border-radius: 999px; background: var(--bg-input); border: 1px solid var(--border); color: var(--fg); white-space: nowrap; font-variant-numeric: tabular-nums; }

.pager { display: flex; justify-content: center; gap: 1em; margin-top: 1em; align-items: center; color: var(--fg-muted); }
.pager-info { padding: 0 .5em; }

.cards { display: grid; grid-template-columns: 1fr 1fr; gap: 1em; margin-top: 1em; }
.card { background: var(--bg-card); padding: 1em 1.25em; border-radius: var(--radius); box-shadow: var(--shadow); }
.card.wide { grid-column: 1 / -1; margin-top: 1em; }
.card h2 { margin-top: 0; font-size: 1.05em; color: var(--accent); }
.card dl { display: grid; grid-template-columns: 11em 1fr; row-gap: .25em; column-gap: 1em; margin: 0; }
.card dt { color: var(--fg-muted); }
.card dd { margin: 0; }

.back { color: var(--fg-muted); display: inline-block; margin-bottom: .5em; }
.muted { color: var(--fg-muted); }
.reg-no { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--fg-muted); }

.status { padding: .15em .55em; border-radius: 999px; font-size: .85em; font-weight: 500; }
.status-running { background: rgba(2,132,199,.12); color: var(--accent); }
.status-done { background: rgba(5,150,105,.12); color: var(--ok); }
.status-cancelled { background: rgba(217,119,6,.12); color: var(--warn); }
.status-failed { background: rgba(220,38,38,.12); color: var(--danger); }

pre.log { max-height: 24em; overflow: auto; background: var(--bg-input); padding: .75em; border-radius: var(--radius); white-space: pre-wrap; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; }

.detail h1 { margin: 0; }
.detail .reg-no { margin-top: 0; }
