:root {
  --bg: #17110d;
  --surface: #221a14;
  --surface-2: #2b211a;
  --line: #3d2e23;
  --text: #f4e9da;
  --muted: #b3a08b;
  --accent: #e0913f;
  --accent-ink: #1a1209;
  --danger: #d1584a;
  --ok: #63c081;
  --busy: #e5b34a;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }

/* Class selectors like `.job { display: grid }` outrank the UA rule for
   [hidden], so hidden elements need this to actually stay hidden. */
[hidden] { display: none !important; }

html {
  height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100%;
  min-height: 100dvh;
  padding:
    max(16px, env(safe-area-inset-top, 0px))
    max(16px, env(safe-area-inset-right, 0px))
    max(16px, env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  align-items: center;
  align-items: safe center;
  justify-content: center;
  overflow-x: clip;
  background:
    radial-gradient(900px 500px at 50% -10%, #35241a 0%, transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.card {
  width: min(520px, 100%);
  max-width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  display: grid;
  gap: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

.card-narrow { width: min(400px, 100%); gap: 20px; }

h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.01em;
}

p { margin: 0; }

.muted { color: var(--muted); font-size: 0.85rem; }

.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; }

.stack { display: grid; gap: 16px; }

/* header */

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.topbar form { flex: none; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand > div { min-width: 0; }

.brand .muted { overflow-wrap: anywhere; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 10px;
  background: linear-gradient(160deg, #f0a95c, #c9783a);
  color: var(--accent-ink);
}

.brand-mark svg { width: 20px; height: 20px; }

/* status */

.status { display: grid; gap: 8px; justify-items: start; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 7px 14px 7px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-weight: 600;
  font-size: 0.95rem;
}

.pill .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--muted);
}

.pill-ok { border-color: rgba(99, 192, 129, 0.4); }
.pill-ok .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(99, 192, 129, 0.16); }

.pill-busy { border-color: rgba(229, 179, 74, 0.4); }
.pill-busy .dot { background: var(--busy); animation: pulse 1.4s ease-in-out infinite; }

.pill-off .dot { background: #6d5c4c; }

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 179, 74, 0.35); }
  50% { box-shadow: 0 0 0 6px rgba(229, 179, 74, 0); }
}

/* job progress */

.job {
  display: grid;
  gap: 10px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.job-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.9rem;
}

.job-head > span:first-child { min-width: 0; overflow-wrap: anywhere; }

.job-error {
  border-color: rgba(209, 88, 74, 0.5);
  background: rgba(209, 88, 74, 0.12);
  color: #ffb3a8;
}

.bar {
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: #3a2c22;
  overflow: hidden;
}

.bar span {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  transform: translateX(-100%);
}

.bar-active span { animation: slide 1.5s ease-in-out infinite; }

@keyframes slide {
  to { transform: translateX(100%); }
}

/* stats */

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
  overflow: hidden;
}

.stats > div {
  background: var(--surface);
  padding: 14px 16px;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.stat-wide { grid-column: 1 / -1; }

dt {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

dt .icon { width: 13px; height: 13px; }

dd {
  margin: 0;
  min-width: 0;
  font-size: 1.02rem;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.budget {
  margin-top: 8px;
  height: 4px;
  border-radius: 999px;
  background: #3a2c22;
  overflow: hidden;
}

.budget span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-width: 0;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.copy code {
  min-width: 0;
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: clamp(0.8rem, 3.6vw, 0.95rem);
  overflow-wrap: anywhere;
}

.copy-icon {
  display: grid;
  place-items: center;
  flex: none;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px;
}

.copy-icon .icon { width: 14px; height: 14px; }

.copy:hover .copy-icon,
.copy:focus-visible .copy-icon { color: var(--text); border-color: var(--accent); }

/* buttons */

.actions { display: grid; grid-template-columns: 1fr; gap: 12px; }

.icon {
  width: 18px;
  height: 18px;
  flex: none;
  display: block;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font: inherit;
  font-weight: 650;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.06s ease, filter 0.15s ease, background 0.15s ease;
}

.btn-icon { width: 38px; height: 38px; padding: 0; }

.btn:active:not(:disabled) { transform: translateY(1px); }

.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

.btn-danger { background: transparent; border-color: rgba(209, 88, 74, 0.6); color: #ffb3a8; }
.btn-danger:hover:not(:disabled) { background: rgba(209, 88, 74, 0.14); }

.btn-ghost { background: transparent; border-color: var(--line); color: var(--muted); padding: 8px 12px; font-size: 0.85rem; }
.btn-ghost:hover { color: var(--text); }

.btn-block { width: 100%; }

button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* forms */

.field { display: grid; gap: 8px; }

.field-label { font-size: 0.8rem; color: var(--muted); }

.field-input { position: relative; display: flex; }

.field-input input {
  font: inherit;
  font-size: 16px;
  width: 100%;
  min-width: 0;
  padding: 12px 52px 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #1b1410;
  color: var(--text);
}

.field-input input:focus { border-color: var(--accent); }

.reveal {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  background: none;
  border: 0;
  color: var(--muted);
  padding: 0;
  cursor: pointer;
  border-radius: 6px;
}

.reveal .icon { width: 18px; height: 18px; }

.reveal:hover { color: var(--text); }

/* misc */

.alert {
  margin: 0;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 0.88rem;
}

.alert-error {
  background: rgba(209, 88, 74, 0.14);
  border: 1px solid rgba(209, 88, 74, 0.45);
  color: #ffb3a8;
}

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 8px 16px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  font-size: 0.8rem;
}

@media (max-width: 560px) {
  body {
    padding:
      max(12px, env(safe-area-inset-top, 0px))
      max(12px, env(safe-area-inset-right, 0px))
      max(12px, env(safe-area-inset-bottom, 0px))
      max(12px, env(safe-area-inset-left, 0px));
  }

  .card {
    padding: 20px 16px;
    gap: 18px;
    border-radius: 12px;
  }

  .topbar { gap: 10px; }

  h1 { font-size: 1.08rem; }

  .btn,
  .btn-block { min-height: 44px; }

  .btn-icon {
    width: 44px;
    height: 44px;
    min-height: 44px;
  }

  .copy-icon { min-width: 36px; min-height: 36px; }
}

@media (max-width: 420px) {
  .stats > div { padding: 12px 12px; }

  dt { font-size: 0.68rem; letter-spacing: 0.04em; }

  dd { font-size: 0.95rem; }

  .brand-mark { width: 34px; height: 34px; }

  .job-head { flex-wrap: wrap; }

  .foot { flex-direction: column; gap: 4px; }
}

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