:root {
  --bg: #0b0f14;
  --panel: #161d27;
  --panel-2: #1e2733;
  --line: #2c3848;
  --text: #f2f6f8;
  --muted: #8b98a8;
  --accent: #1f8a56;
  --accent-2: #3dce86;
  --warn: #e0b341;
  --danger: #e06a6a;
  --radius: 16px;
  --font: "Noto Sans TC", "PingFang HK", "Segoe UI", system-ui, sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}
body { overscroll-behavior-y: none; }
a { color: inherit; text-decoration: none; }

.app {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  padding: calc(12px + var(--safe-t)) 16px calc(88px + var(--safe-b));
}
@media (min-width: 900px) {
  .app { max-width: 920px; }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: calc(-12px - var(--safe-t)) -16px 12px;
  padding: calc(14px + var(--safe-t)) 16px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(16px);
}
.topbar h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.pill {
  margin-left: auto;
  font-size: 12px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  border: 1px solid var(--line);
}
.pill.ok { color: #b8f5d4; border-color: #1f8a56; background: #123524; }
.pill.warn { color: #ffe7a3; border-color: #8a6a1f; background: #3a2e12; }
.pill.bad { color: #ffc9c9; border-color: #8a3030; background: #3a1616; }

.tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: min(480px, 100%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: color-mix(in srgb, #10161d 92%, transparent);
  backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
  z-index: 20;
}
@media (min-width: 900px) {
  .tabbar { width: min(920px, 100%); }
}
.tabbar a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 0 8px;
  color: var(--muted);
  font-size: 11px;
  min-height: 56px;
}
.tabbar a .ico { font-size: 18px; line-height: 1; }
.tabbar a.active { color: var(--accent-2); font-weight: 650; }

.grid2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.card h2 {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}
.big { font-size: 1.7rem; font-weight: 750; letter-spacing: -0.03em; }
.sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.chips button, .chip {
  flex: 0 0 auto;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
}
.chips button.on { background: #123524; border-color: var(--accent); color: var(--accent-2); }

.job {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin: 0 0 10px;
  color: inherit;
  font: inherit;
  cursor: pointer;
}
.job .meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.job .body {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.4;
}
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: #243040;
}
.badge.Open { background: #24385a; }
.badge.Pending { background: #5a4614; color: #ffe7a3; }
.badge.Completed { background: #145233; color: #b8f5d4; }
.badge.Failed, .badge.Cancel { background: #5a2222; color: #ffc9c9; }
.badge.Skipped { background: #333; color: #bbb; }

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 30;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet .panel {
  width: min(480px, 100%);
  max-height: 86dvh;
  overflow: auto;
  background: var(--panel);
  border-radius: 20px 20px 0 0;
  padding: 16px 16px calc(20px + var(--safe-b));
  border: 1px solid var(--line);
}
@media (min-width: 900px) {
  .sheet { align-items: center; }
  .sheet .panel { border-radius: 20px; max-width: 560px; }
}

button, .btn {
  background: var(--accent);
  color: #fff;
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  min-height: 44px;
}
button.secondary { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); }
button.ghost { background: transparent; color: var(--muted); }

input, select, textarea {
  width: 100%;
  background: #0f141b;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 12px;
  padding: 12px;
  font: inherit;
  margin: 6px 0 12px;
  min-height: 44px;
}
label { font-size: 13px; color: var(--muted); }

.login-wrap {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(500px 240px at 20% 0%, #163828, transparent 60%),
    var(--bg);
}
.login-box {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 28px 22px;
}
.login-box h1 { margin: 0 0 4px; font-size: 1.6rem; }
.mark {
  width: 48px; height: 48px; border-radius: 14px;
  background: linear-gradient(160deg, #3dce86, #1a6b42);
  display: grid; place-items: center; font-weight: 800; margin-bottom: 14px;
}

.qr { width: min(240px, 70vw); border-radius: 12px; background: #fff; padding: 8px; }
.muted { color: var(--muted); font-size: 13px; }
.row { display: flex; gap: 8px; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.hidden { display: none !important; }
.err { color: #ffb4b4; min-height: 1.2em; font-size: 14px; }
pre.plain {
  white-space: pre-wrap;
  font: inherit;
  font-size: 13px;
  color: var(--muted);
  margin: 8px 0 0;
}
