*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font: var(--fs-m) / 1.45 var(--font);
  color: var(--text);
  background: radial-gradient(1200px 600px at 10% -10%, #e8f0fb 0%, transparent 60%),
    radial-gradient(900px 500px at 110% 10%, #eef0f4 0%, transparent 55%), var(--bg);
  background-attachment: fixed;
}
[hidden] { display: none !important; }
main { max-width: 1080px; margin: 0 auto; padding: var(--s5) var(--s4) var(--s7); }
h1 { font-size: var(--fs-xl); letter-spacing: -0.02em; margin: 0; font-weight: 700; }
h2 { font-size: var(--fs-l); letter-spacing: -0.01em; margin: 0 0 var(--s4); font-weight: 650; }
p { margin: var(--s2) 0; }
code { font: var(--fs-s) var(--mono); background: var(--fill); padding: 2px 6px; border-radius: 6px; word-break: break-all; }
.muted { color: var(--text-2); font-size: var(--fs-s); }
.bad { color: var(--bad); }
.stale { color: var(--warn); }
.num { font-variant-numeric: tabular-nums; }

.card {
  background: var(--surface);
  -webkit-backdrop-filter: var(--blur);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: var(--s5);
  animation: rise var(--t-slow) var(--ease) both;
  animation-delay: calc(var(--i, 0) * var(--stagger));
}
.narrow { max-width: 420px; margin: 12vh auto 0; }
.grid { display: grid; gap: var(--s4); grid-template-columns: 1fr; margin-top: var(--s5); }
.grid > :nth-child(1) { --i: 1; }
.grid > :nth-child(2) { --i: 2; }
.grid > :nth-child(3) { --i: 3; }
.grid > :nth-child(4) { --i: 4; }
@media (min-width: 860px) {
  .grid { grid-template-columns: 1fr 1.4fr; }
  .wide { grid-column: 1 / -1; }
}
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.top { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.top h1 { margin-right: auto; }

label { display: grid; gap: var(--s1); font-size: var(--fs-s); color: var(--text-2); }
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-s);
  padding: 10px 12px;
  width: 100%;
  transition: border-color var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease);
}
textarea { resize: vertical; min-height: 96px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.18); }
form { display: grid; gap: var(--s3); }
.row { display: flex; gap: var(--s3); align-items: end; flex-wrap: wrap; }
.row > label { flex: 1 1 140px; }

button {
  font: inherit;
  font-weight: 600;
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease), background var(--t-fast) var(--ease), opacity var(--t-fast);
}
button:active { transform: scale(0.97); }
button:disabled { opacity: 0.5; cursor: default; }
button:focus-visible { outline: 3px solid rgba(0, 113, 227, 0.4); outline-offset: 2px; }
.primary { background: var(--accent); color: #fff; }
.primary:hover { background: var(--accent-press); }
.ghost { background: var(--fill); color: var(--text); }
.danger { background: transparent; color: var(--bad); box-shadow: inset 0 0 0 1px var(--line); }

.pill { font-size: var(--fs-s); padding: 6px 12px; border-radius: 999px; background: var(--fill); color: var(--text-2); }
.pill::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; background: currentColor; vertical-align: 1px; }
.pill.on { color: var(--ok); }
.pill.busy { color: var(--accent); }
.pill.warn { color: var(--warn); }
.pill.off { color: var(--text-2); }

.meter { margin-bottom: var(--s4); }
.meter-head { display: flex; justify-content: space-between; font-size: var(--fs-s); }
.meter-head strong { font-size: var(--fs-m); }
.bar { height: 8px; border-radius: 999px; background: var(--fill); overflow: hidden; margin: 6px 0 4px; }
.bar i { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width var(--t-slow) var(--ease); }
.bar i.high { background: var(--warn); }
.bar i.full { background: var(--bad); }

.chip { font-size: var(--fs-xs); font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--fill); color: var(--text-2); white-space: nowrap; }
.s-running, .s-queued { color: var(--accent); background: rgba(0, 113, 227, 0.1); }
.s-done { color: var(--ok); background: rgba(10, 125, 62, 0.1); }
.s-review { color: var(--warn); background: rgba(154, 74, 0, 0.1); }
.s-failed { color: var(--bad); background: rgba(201, 0, 26, 0.08); }

.live-head { display: flex; gap: var(--s3); align-items: baseline; justify-content: space-between; }
.live-head h2 { margin: 0; overflow-wrap: anywhere; }
.steps { list-style: none; padding: 0; margin: var(--s3) 0; display: grid; gap: 2px; font-size: var(--fs-s); color: var(--text-2); max-height: 180px; overflow: auto; }
.steps time { font-variant-numeric: tabular-nums; margin-right: var(--s2); opacity: 0.7; }
.step.k-error { color: var(--bad); }
.live-text {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: var(--fs-m) / 1.55 var(--font);
  background: var(--surface-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius-m);
  padding: var(--s4);
  margin: var(--s3) 0;
  max-height: 55vh;
  overflow: auto;
}
.live-text:empty { display: none; }
.result { border-top: 1px solid var(--line); margin-top: var(--s3); padding-top: var(--s3); }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s1); }
.list .empty { color: var(--text-2); }
.task-row {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px var(--s3);
  text-align: left;
  background: transparent;
  border-radius: var(--radius-m);
  padding: 10px 12px;
  font-weight: 400;
  color: var(--text);
}
.task-row:hover, .list .active .task-row { background: var(--fill); }
.task-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { grid-column: 1; font-size: var(--fs-xs); color: var(--text-2); }
.task-row .chip { grid-row: 1 / span 2; grid-column: 2; align-self: center; }

.mfa-qr { display: block; width: 200px; height: 200px; margin: var(--s3) auto; background: #fff; border-radius: var(--radius-s); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
