:root {
  --bg: #f3f5f7;
  --card: #ffffff;
  --ink: #17202a;
  --muted: #66727f;
  --line: #e1e6eb;
  --accent: #0f6e6a;
  --accent-ink: #ffffff;
  --ok: #157f3b;
  --bad: #b42318;
  --warn: #a15c07;
  --run: #1d5fbf;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1418;
    --card: #171e24;
    --ink: #e6ebef;
    --muted: #93a0ac;
    --line: #26313a;
    --accent: #3fb3a9;
    --accent-ink: #06201e;
    --ok: #5cc98a;
    --bad: #ff8a80;
    --warn: #f0b45a;
    --run: #7fb0ff;
  }
}
* { box-sizing: border-box; }
html { color-scheme: light dark; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Sarabun", "Noto Sans Thai", "Leelawadee UI", system-ui, sans-serif;
}
a { color: var(--accent); }
code { font-size: 13px; background: var(--bg); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.wrap { max-width: 1180px; margin: 0 auto; padding-inline: 16px; }
.top { background: var(--card); border-bottom: 1px solid var(--line); }
.bar { display: flex; align-items: center; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; display: flex; gap: 8px; align-items: center; }
.logo { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: var(--accent-ink); }
nav { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
nav a { padding: 6px 10px; border-radius: 8px; color: var(--muted); text-decoration: none; }
nav a.on, nav a:hover { color: var(--ink); background: var(--bg); }
main { padding-block: 20px 48px; display: flex; flex-direction: column; gap: 16px; }
h1, h2 { margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 22px; }
h2 { font-size: 17px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.card.narrow { max-width: 420px; margin: 40px auto; width: 100%; }
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.stat span { color: var(--muted); font-size: 13px; }
.stat b { font-size: 20px; }
.stat small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; border-top: 0; letter-spacing: .02em; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
tr.dim td { opacity: .55; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.ok-t { color: var(--ok); }
.bad { color: var(--bad); }
.warn { color: var(--warn); }
.badge { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 99px; border: 1px solid currentColor; }
.badge.ok { color: var(--ok); }
.badge.bad { color: var(--bad); }
.badge.run { color: var(--run); }
.badge.wait { color: var(--muted); }
.btn {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 14px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.danger { color: var(--bad); border-color: currentColor; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.inline { display: inline; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: flex-start; justify-content: flex-end; }
details { position: relative; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary { border-color: var(--accent); }
.box { margin-top: 8px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); min-width: 260px; text-align: left; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; align-items: end; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); font-size: 14px; }
input:not([type=checkbox]) {
  font: inherit; font-size: 15px; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; min-height: 40px; width: 100%;
}
input:focus-visible, .btn:focus-visible, button.link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.flash { padding: 10px 14px; border-radius: 10px; margin: 0; border: 1px solid currentColor; background: var(--card); }
.flash.ok { color: var(--ok); }
.flash.bad { color: var(--bad); }
.job p { margin: 0; }
.job p + p { margin-top: 4px; }
.spin { display: inline-block; width: 12px; height: 12px; border: 2px solid var(--run); border-right-color: transparent; border-radius: 50%; animation: s 1s linear infinite; vertical-align: -1px; }
@keyframes s { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
@media (max-width: 640px) {
  .actions { justify-content: flex-start; }
  th, td { padding: 8px 6px; }
}
