:root {
  color-scheme: light;
  --bg: #f5f7f6;
  --surface: #ffffff;
  --ink: #173229;
  --muted: #64736d;
  --line: #dfe7e3;
  --brand: #167452;
  --brand-dark: #0e543b;
  --safe: #e4f5ed;
  --danger: #a53832;
  --warning: #8a6114;
  font-family: "Segoe UI", Tahoma, Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); line-height: 1.55; }
a { color: inherit; }
.container { width: min(1180px, calc(100% - 32px)); margin-inline: auto; }
.topbar { background: #102d24; color: #fff; border-bottom: 3px solid #6dc29f; }
.topbar-inner { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { font-weight: 800; font-size: 20px; text-decoration: none; letter-spacing: .2px; }
.brand span { color: #b8d8cb; font-weight: 500; font-size: 14px; margin-inline-start: 8px; }
.page { padding-block: 36px 64px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(26px, 4vw, 38px); line-height: 1.2; }
h2 { margin-bottom: 6px; font-size: 21px; }
.muted { color: var(--muted); }
.eyebrow { color: var(--brand); font-size: 13px; font-weight: 800; letter-spacing: .4px; margin-bottom: 5px; }
.card, .table-card, .metric { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 8px 24px rgba(21, 52, 42, .04); }
.auth-card { width: min(460px, 100%); margin: 5vh auto 0; padding: clamp(24px, 5vw, 42px); }
.stack { display: grid; gap: 18px; margin-top: 26px; }
label { display: grid; gap: 7px; font-weight: 700; font-size: 14px; }
input, select { width: 100%; min-height: 46px; padding: 9px 12px; border: 1px solid #c9d7d1; border-radius: 9px; background: #fff; color: var(--ink); font: inherit; }
input:focus, select:focus { outline: 3px solid rgba(22, 116, 82, .15); border-color: var(--brand); }
.button { min-height: 42px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid transparent; border-radius: 9px; padding: 8px 16px; font: inherit; font-weight: 800; cursor: pointer; text-decoration: none; }
.button-primary { color: #fff; background: var(--brand); }
.button-primary:hover { background: var(--brand-dark); }
.button-quiet { color: inherit; background: transparent; border-color: rgba(255,255,255,.35); }
.page .button-quiet { border-color: var(--line); background: var(--surface); }
.button:disabled { opacity: .55; cursor: not-allowed; }
.alert { padding: 12px 15px; margin-bottom: 20px; border-radius: 9px; border: 1px solid; }
.alert-success { color: #155a3f; background: #e7f6ef; border-color: #b9decf; }
.alert-warning { color: #744f0a; background: #fff6dd; border-color: #ecd698; }
.alert-error { color: #842b27; background: #fff0ef; border-color: #efc1be; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading.compact h1 { font-size: clamp(18px, 3vw, 28px); overflow-wrap: anywhere; }
.pill, .status { display: inline-flex; align-items: center; width: max-content; border-radius: 999px; padding: 5px 10px; font-size: 12px; font-weight: 900; }
.pill-safe { color: #145c40; background: var(--safe); }
.run-panel { padding: 24px; display: grid; grid-template-columns: minmax(240px, 1fr) minmax(300px, .8fr); align-items: center; gap: 28px; }
.run-form { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.queue-note { grid-column: 1 / -1; margin: 0; color: var(--warning); }
.section-heading { margin: 36px 0 14px; display: flex; justify-content: space-between; align-items: end; }
.table-card { overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 13px 14px; text-align: right; border-bottom: 1px solid var(--line); vertical-align: top; }
th { background: #edf2f0; color: #44554f; font-size: 12px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafcfb; }
.nowrap { white-space: nowrap; }
.empty { text-align: center; color: var(--muted); padding: 34px; }
.text-link, .back-link { color: var(--brand); font-weight: 800; text-decoration: none; }
.back-link { display: inline-block; margin-bottom: 20px; }
.status-completed, .status-dry_run, .status-success { color: #145c40; background: #e4f5ed; }
.status-failed { color: #8b2f2b; background: #fde8e7; }
.status-running { color: #76520b; background: #fff3cf; }
.status-blocked_by_safeguards { color: #744f0a; background: #fff1c9; }
.status-completed_with_errors { color: #744f0a; background: #fff1c9; }
.metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 24px; }
.metric { padding: 17px; display: grid; gap: 5px; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { font-size: 25px; }
.metric .metric-text { font-size: 17px; overflow-wrap: anywhere; }
.overview-metrics { margin-bottom: 24px; }
.error-cell { min-width: 220px; color: var(--danger); }
.pagination { margin-top: 20px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 820px) {
  .page-heading, .run-panel { display: grid; grid-template-columns: 1fr; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .container { width: min(100% - 20px, 1180px); }
  .page { padding-top: 24px; }
  .run-form { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .brand span { display: none; }
}
