:root {
  --brand: #1b5ea8;
  --brand-dark: #143f74;
  --brand-soft: #e7f0fb;
  --border: #dde8f5;
  --text: #1a2e45;
  --muted: #5a7490;
  --bg: #edf3fb;
  --green: #27a96c;
  --amber: #d97706;
  --red: #dc2626;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Nunito Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: var(--brand); text-decoration: none; }
main { padding: 24px 28px 48px; }
.topbar {
  align-items: center;
  background: var(--brand-dark);
  color: white;
  display: flex;
  justify-content: space-between;
  padding: 12px 32px;
}
.topbar a { color: rgba(255,255,255,.75); }
.wordmark { font-weight: 800; letter-spacing: .04em; }
.wordmark span { color: #7cc8f0; }
.tagline { color: rgba(255,255,255,.55); font-size: 12px; margin-top: 2px; }
.hero {
  align-items: end;
  background: linear-gradient(135deg, var(--brand), #2070c8);
  border-radius: 16px;
  color: white;
  display: flex;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 24px;
}
.hero h1 { margin: 0 0 6px; }
.hero p { color: rgba(255,255,255,.75); margin: 0; }
.run-select label, label { color: var(--muted); display: block; font-size: 12px; font-weight: 700; margin-bottom: 5px; text-transform: uppercase; }
select, input, textarea {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  padding: 9px 10px;
  width: 100%;
}
button, .button-link {
  background: var(--brand);
  border: 0;
  border-radius: 9px;
  color: white;
  cursor: pointer;
  display: inline-block;
  font-weight: 700;
  margin-top: 12px;
  padding: 10px 14px;
}
button.secondary { background: var(--brand-dark); }
button.danger { background: var(--red); }
.kpis {
  display: grid;
  gap: 1px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
  overflow: hidden;
  border-radius: 14px;
}
.kpis div { background: white; padding: 18px; text-align: center; }
.kpis strong { color: var(--brand); display: block; font-size: 30px; }
.kpis span { color: var(--muted); font-size: 12px; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.tabs a {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 999px;
  font-weight: 700;
  padding: 8px 13px;
}
.panel {
  background: white;
  border: 1.5px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(27,94,168,.08);
  margin-bottom: 20px;
  padding: 20px;
}
.panel h2 { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card-form, .stat-card {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.inline { display: grid; gap: 10px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.inline.two-buttons { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.top-gap { margin-top: 18px; }
.filters {
  background: #f8fbff;
  border: 1px solid var(--border);
  border-radius: 12px;
  display: grid;
  gap: 10px;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  margin-bottom: 16px;
  padding: 14px;
}
.results-badge { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.cards {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}
.job-card {
  border: 1.5px solid var(--border);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(27,94,168,.06);
  display: flex;
  flex-direction: column;
  padding: 16px;
}
.job-head { align-items: start; display: flex; gap: 10px; justify-content: space-between; }
.job-head h3 { font-size: 17px; line-height: 1.25; margin: 0; }
.muted { color: var(--muted); font-size: 12px; }
.job-card p { color: #3a5068; font-size: 14px; }
.category-line {
  color: var(--brand);
  font-size: 12px;
  font-weight: 800;
  margin-top: 6px;
}
.pills { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.pills span, .status {
  background: var(--brand-soft);
  border-radius: 999px;
  color: var(--brand-dark);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
}
.status.published { background: #d4f5e6; color: #1e8755; }
.status.publish_failed { background: #fee2e2; color: var(--red); }
.issues {
  background: #fff7ed;
  border-radius: 8px;
  color: #9a3412;
  font-size: 12px;
  margin-top: 10px;
  padding: 8px;
}
.job-card footer {
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  padding-top: 10px;
}
.log {
  background: #0f172a;
  border-radius: 12px;
  color: #dbeafe;
  max-height: 420px;
  overflow: auto;
  padding: 14px;
  white-space: pre-wrap;
}
.status-line { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; }
.running-banner {
  background: #ecfdf5;
  border: 1px solid #86efac;
  border-radius: 10px;
  color: #166534;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 14px;
  padding: 12px 14px;
}
.progress-wrap { margin-bottom: 14px; }
.progress-label {
  color: var(--brand-dark);
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
}
.progress-track {
  background: #dbeafe;
  border-radius: 999px;
  height: 12px;
  overflow: hidden;
}
.progress-fill {
  background: linear-gradient(90deg, var(--brand), #38bdf8);
  border-radius: 999px;
  height: 100%;
  min-width: 2%;
  transition: width .45s ease;
}
.progress-meta {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  margin-top: 6px;
  text-align: right;
}
.live-monitor {
  margin-bottom: 18px;
}
.live-monitor-head {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 10px;
}
.live-monitor-head h2 { margin: 0; }
.live-pill {
  background: #ecfdf5;
  border: 1px solid #86efac;
  border-radius: 999px;
  color: #166534;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
}
.activity-line {
  background: #eff6ff;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--brand-dark);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  margin-bottom: 12px;
  padding: 10px 12px;
}
.status-line.compact {
  font-size: 12px;
  margin-bottom: 0;
  margin-top: 10px;
}
.log-accordion {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 10px;
}
.log-accordion summary {
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  list-style: none;
  margin-bottom: 8px;
}
.log-accordion summary::-webkit-details-marker { display: none; }
.log-toolbar {
  align-items: center;
  display: flex;
  font-size: 12px;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 8px;
}
.log-latest-line {
  background: #f8fafc;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 8px;
  padding: 8px 10px;
}
.follow-live { margin-top: 0; }
.hidden { display: none !important; }
.current-command {
  background: #eff6ff;
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--brand-dark);
  font-size: 12px;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
  padding: 10px;
}
.prompt-list { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.prompt-list a {
  background: var(--brand-soft);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 10px;
}
.prompt-editor textarea { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; min-height: 520px; }
.source-table { overflow: auto; }
.source-table table { border-collapse: collapse; min-width: 980px; width: 100%; }
.source-table th, .source-table td {
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  padding: 9px 8px;
  text-align: left;
  vertical-align: top;
}
.source-table th { color: var(--muted); font-size: 11px; text-transform: uppercase; }
.grade {
  border-radius: 999px;
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
}
.grade-A { background: #d4f5e6; color: #1e8755; }
.grade-C { background: #fef3c7; color: #92400e; }
.grade-SKIP { background: #fee2e2; color: var(--red); }
.notice {
  background: #d4f5e6;
  border-radius: 10px;
  color: #1e8755;
  font-weight: 700;
  margin-bottom: 14px;
  padding: 10px;
}
.notice.error {
  background: #fee2e2;
  color: var(--red);
}
.empty { color: var(--muted); padding: 30px; text-align: center; }
pre { overflow: auto; white-space: pre-wrap; }
.topbar-actions { align-items: center; display: flex; gap: 16px; }
.topbar-user { color: rgba(255,255,255,.85); font-size: 13px; }
.logout-form { display: inline; margin: 0; }
.link-button {
  background: transparent;
  border: 0;
  color: rgba(255,255,255,.75);
  cursor: pointer;
  font: inherit;
  padding: 0;
  text-decoration: underline;
}
.login-page {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: calc(100vh - 64px);
  padding: 32px 28px 48px;
}
.login-shell {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 420px);
  max-width: 980px;
  width: 100%;
}
.login-brand {
  align-items: stretch;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-bottom: 0;
  min-height: 100%;
}
.login-brand-copy h1 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  line-height: 1.15;
  margin: 0 0 10px;
}
.login-eyebrow {
  color: rgba(255,255,255,.72);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  margin: 0 0 10px;
  text-transform: uppercase;
}
.login-lead {
  color: rgba(255,255,255,.78);
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
  max-width: 42ch;
}
.login-meta {
  display: grid;
  gap: 12px;
  margin-top: 28px;
}
.login-pill {
  background: rgba(255,255,255,.14);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 999px;
  color: white;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 7px 12px;
  width: fit-content;
}
.login-server {
  background: rgba(15,23,42,.22);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 12px 14px;
}
.login-server-label {
  color: rgba(255,255,255,.58);
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  margin-bottom: 6px;
  text-transform: uppercase;
}
.login-server code {
  color: #dbeafe;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
  font-size: 12px;
  word-break: break-all;
}
.login-form-panel {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  margin-bottom: 0;
}
.login-form-head h2 {
  margin: 0 0 6px;
}
.login-form-head p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  margin: 0 0 18px;
}
.login-form {
  background: #f8fbff;
  margin-top: 0;
}
.login-form label:first-of-type {
  margin-top: 0;
}
.login-form input {
  background: white;
}
.login-form input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(27,94,168,.12);
  outline: none;
}
.login-submit {
  font-size: 15px;
  margin-top: 18px;
  padding: 12px 16px;
  width: 100%;
}
.login-footnote {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 16px 0 0;
}
.readonly-note {
  background: var(--brand-soft);
  border-radius: 8px;
  color: var(--brand-dark);
  margin-bottom: 12px;
  padding: 10px 12px;
}
@media (max-width: 900px) {
  .hero, .topbar { align-items: start; flex-direction: column; gap: 12px; }
  .kpis, .grid.two, .filters, .inline { grid-template-columns: 1fr; }
  .login-shell { grid-template-columns: 1fr; }
  .login-brand { min-height: auto; }
}

