:root {
  --bg: #f5f6f8; --surface: #ffffff; --text: #1b1f24; --muted: #5f6b7a; --border: #dde1e6;
  --accent: #714b67; --accent-text: #ffffff;
  --pass: #1a7f37; --pass-bg: #dcf5e3; --fail: #b42318; --fail-bg: #fde4e1;
  --warn: #9a6700; --warn-bg: #fff4cc; --info: #0b5cad; --info-bg: #dcebfb; --idle: #8a94a3; --idle-bg: #eceff3;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12151a; --surface: #1b1f26; --text: #e6e9ee; --muted: #9aa5b4; --border: #2c323c;
    --accent: #b88ab0; --accent-text: #12151a;
    --pass: #56d37a; --pass-bg: #163a22; --fail: #ff7b72; --fail-bg: #4a1d1a;
    --warn: #e3b341; --warn-bg: #3d2f0a; --info: #6cb6ff; --info-bg: #13304f; --idle: #6e7781; --idle-bg: #262c35;
  }
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--info); }
[hidden] { display: none !important; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
  padding: 10px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a { padding: 6px 12px; border-radius: 6px; color: var(--muted); text-decoration: none; font-size: 14px; }
.nav a:hover { background: var(--bg); color: var(--text); }
.nav a.on { background: var(--bg); color: var(--text); font-weight: 600; }
.who { margin-left: auto; display: flex; align-items: center; gap: 8px; font-size: 14px; }
.who form { margin: 0; }

main { max-width: 1280px; margin: 0 auto; padding: 24px 16px 48px; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 16px; margin: 0; } h3 { font-size: 15px; margin: 0 0 8px; }
.section-title { font-size: 17px; margin: 28px 0 12px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.section-title .muted { font-weight: 400; }
.muted { color: var(--muted); } .small { font-size: 13px; }
.toolbar { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; } .actions form { margin: 0; }

/* Buttons and inputs */
.btn { display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover:not([disabled]) { border-color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn.subtle { border-color: transparent; color: var(--muted); }
.btn.danger { color: var(--fail); border-color: var(--fail); }
.small-btn { padding: 3px 10px; font-size: 13px; }
select, input, textarea { font: inherit; font-size: 14px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); color: var(--text); }
input[type="checkbox"] { width: 16px; height: 16px; }
input.num { width: 90px; }

/* Summary tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; display: flex; flex-direction: column; }
.tile.wide { grid-column: span 2; }
.tile-num { font-size: 26px; font-weight: 700; } .tile-num small { font-size: 15px; color: var(--muted); font-weight: 500; }
.tile-num.pass { color: var(--pass); } .tile-num.fail { color: var(--fail); }
.tile-text { font-size: 18px; font-weight: 700; padding: 4px 0 3px; }
@media (max-width: 640px) { .tile.wide { grid-column: auto; } }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 8px; }
.batch-cards { grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); }
.card, .panel { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 16px; }
.panel { margin-bottom: 16px; }
.card { display: flex; flex-direction: column; gap: 8px; }
.card p { margin: 0; }
.card.disabled { opacity: .6; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; flex-wrap: wrap; }
.card-actions { display: flex; gap: 6px; margin-top: auto; padding-top: 6px; flex-wrap: wrap; } .card-actions form { margin: 0; }
.card code { word-break: break-all; }

/* Batch steps */
.steps { list-style: none; margin: 2px 0; padding: 0; border-left: 2px solid var(--border); }
.steps li { display: flex; align-items: center; gap: 8px; padding: 4px 0 4px 10px; position: relative; font-size: 14px; }
.steps li.parallel { border-left: 2px dashed var(--info); margin-left: -2px; }
.step-seq { font-size: 12px; color: var(--muted); min-width: 22px; }
.step-name { flex: 1; }

/* Badges, tags, dots */
.badge { display: inline-block; padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .03em; background: var(--idle-bg); color: var(--idle); white-space: nowrap; vertical-align: middle; }
.badge.passed { background: var(--pass-bg); color: var(--pass); }
.badge.failed, .badge.error { background: var(--fail-bg); color: var(--fail); }
.badge.running, .badge.queued { background: var(--info-bg); color: var(--info); }
.badge.planned { background: var(--warn-bg); color: var(--warn); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; }
.tag { font-size: 12px; padding: 1px 8px; border-radius: 4px; background: var(--idle-bg); color: var(--muted); white-space: nowrap; }
.tag.parallel { background: var(--info-bg); color: var(--info); }
.tag.new { background: var(--warn-bg); color: var(--warn); }
.tag.off { background: var(--fail-bg); color: var(--fail); }
.trend { display: flex; gap: 3px; align-items: center; min-height: 14px; flex-wrap: wrap; }
.dot { width: 12px; height: 12px; border-radius: 3px; background: var(--idle); display: inline-block; flex: none; }
.dot.passed { background: var(--pass); } .dot.failed, .dot.error { background: var(--fail); }
.dot.running, .dot.queued { background: var(--info); }

/* Notices */
.notice { background: var(--info-bg); color: var(--info); padding: 10px 14px; border-radius: 8px; margin-bottom: 16px; }
.failure-notice { background: var(--fail-bg); color: var(--fail); }
.failure { border-color: var(--fail); }
.test.failed, .test.timedOut, .test.interrupted { border-left: 4px solid var(--fail); }
.test.passed { border-left: 4px solid var(--pass); }

/* Tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; vertical-align: middle; }
td form { margin: 0; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
table.cases td:first-child { white-space: normal; }
.err-cell { white-space: normal; max-width: 420px; font-size: 13px; }
.suite-block h3 { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.suite-block p { margin: 0 0 8px; }
#filter { min-width: 260px; }

/* Forms */
.form { display: flex; flex-direction: column; gap: 14px; max-width: 760px; }
.wide-form { max-width: 980px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: 14px; }
.form label small { font-weight: 400; }
.form label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
.form fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px 14px; margin: 0; }
.form legend { font-weight: 600; font-size: 14px; padding: 0 6px; }
.form fieldset p { margin: 0 0 10px; }
.form-row { display: grid; grid-template-columns: 1fr 2fr; gap: 14px; }
.form-row.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 640px) { .form-row, .form-row.three { grid-template-columns: 1fr; } }
.steps-table td { white-space: normal; }

/* Schedule picker */
.sched-fields { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; }
.sched-fields label { display: flex; flex-direction: column; font-size: 13px; color: var(--muted); gap: 4px; font-weight: 400; }
.sched-fields .for-hours, .sched-fields .for-weekly, .sched-fields .for-time { display: none; }
.sched-fields[data-kind="hours"] .for-hours { display: flex; }
.sched-fields[data-kind="weekly"] .for-weekly { display: flex; }
.sched-fields[data-kind="daily"] .for-time, .sched-fields[data-kind="weekdays"] .for-time,
.sched-fields[data-kind="weekly"] .for-time { display: flex; }

/* Login */
.login-wrap { display: flex; justify-content: center; padding-top: 8vh; }
.login { width: 100%; max-width: 380px; }

pre { background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 10px; overflow-x: auto;
  font-size: 12.5px; white-space: pre-wrap; word-break: break-word; }
pre.error { border-color: var(--fail); }
code { background: var(--bg); padding: 1px 5px; border-radius: 4px; }
.shots { display: flex; gap: 12px; flex-wrap: wrap; }
.shots img { max-width: 420px; width: 100%; border: 1px solid var(--border); border-radius: 6px; }
details summary { cursor: pointer; color: var(--muted); font-size: 13px; }
