:root {
  color-scheme: light;
  --bg: #f3efe8;
  --bg-2: #fffcf7;
  --ink: #1c1915;
  --muted: #6d675e;
  --line: #ddd6cb;
  --line-strong: #cfc6b8;
  --accent: #c24e12;
  --accent-hover: #a8420e;
  --accent-soft: #f8ebe3;
  --ok: #1f6b3a;
  --ok-bg: #e5f3ea;
  --warn: #9a3412;
  --warn-bg: #fde8dc;
  --run: #1d4f8c;
  --run-bg: #e8eef8;
  --shadow: 0 1px 2px rgba(28, 25, 21, 0.04), 0 10px 28px rgba(28, 25, 21, 0.05);
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 420px at 8% -10%, #fff8ee 0%, transparent 55%),
    var(--bg);
  color: var(--ink);
}

body {
  font-family: Figtree, ui-sans-serif, system-ui, sans-serif;
  line-height: 1.5;
  font-feature-settings: "ss01", "cv11";
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 32px;
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: Fraunces, ui-serif, Georgia, serif;
  font-optical-sizing: auto;
  font-weight: 600;
  font-size: 22px;
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
}

.logo {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  background: var(--accent);
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.06);
}

nav { display: flex; gap: 6px; }

nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: 999px;
}

nav a:hover {
  color: var(--ink);
  background: color-mix(in srgb, #fff 70%, var(--bg));
}

main {
  padding: 40px 32px 72px;
  max-width: 1120px;
  margin: 0 auto;
}

h1 {
  font-family: Fraunces, ui-serif, Georgia, serif;
  font-optical-sizing: auto;
  font-size: clamp(32px, 4vw, 44px);
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.12;
  margin: 0 0 10px;
}

h2 {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 36px 0 14px;
}

.lede {
  color: var(--muted);
  max-width: 52ch;
  margin: 0 0 28px;
  font-size: 17px;
}

.composer {
  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 16px;
  align-items: stretch;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.compose-main {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.presets {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.preset {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 7px 12px;
  font: 600 13px Figtree, sans-serif;
}

.preset:hover { background: #fff8f1; }
.preset.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fffaf6;
}
.preset.is-active:hover { background: var(--accent-hover); }

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

label.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  text-transform: none;
  letter-spacing: 0;
  font-size: 13px;
  font-weight: 500;
}

label.check input {
  width: auto;
  margin: 0;
}

textarea {
  width: 100%;
  min-height: 196px;
  resize: vertical;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 16px;
  font: 16px/1.5 Figtree, sans-serif;
}

textarea::placeholder { color: #9a9388; }

textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

input, select {
  width: 100%;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font: 14px Figtree, sans-serif;
}

button, .btn {
  appearance: none;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fffaf6;
  font: 600 14px Figtree, sans-serif;
  padding: 12px 16px;
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  transition: background 0.15s ease, transform 0.15s ease;
}

button:hover, .btn:hover { background: var(--accent-hover); }
button:disabled { opacity: 0.5; cursor: wait; }

button.ghost, .btn.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line-strong);
}

button.ghost:hover, .btn.ghost:hover {
  background: #fff;
}

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.pill.complete { background: var(--ok-bg); color: var(--ok); }
.pill.failed { background: var(--warn-bg); color: var(--warn); }
.pill.running, .pill.queued, .pill.planned { background: var(--run-bg); color: var(--run); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.card {
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: block;
  box-shadow: var(--shadow);
  transition: transform 0.18s ease, border-color 0.18s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
}

.card .thumb {
  aspect-ratio: 1;
  background:
    linear-gradient(180deg, #f7f2ea 0%, #ebe4d8 100%);
  display: block;
  width: 100%;
  object-fit: contain;
}

.card .meta { padding: 14px 16px 16px; }
.card h3 { margin: 0 8px 0 0; font-size: 16px; display: inline; font-weight: 650; }

.muted { color: var(--muted); font-size: 13px; margin: 8px 0 0; }

.progress {
  height: 4px;
  background: #ebe4d8;
  margin-top: 12px;
  border-radius: 99px;
  overflow: hidden;
}

.progress.fat { height: 6px; border-radius: 99px; overflow: hidden; margin: 12px 0 0; }

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

.job-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 28px;
}

.stats { color: var(--muted); font-size: 13px; margin-top: 8px; }

.empty {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 48px 20px;
  text-align: center;
  color: var(--muted);
  background: color-mix(in srgb, var(--bg-2) 70%, transparent);
}

.detail {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(320px, 1fr);
  gap: 28px;
}

.viewer {
  background:
    radial-gradient(circle at 50% 42%, #fff 0%, #efe8dc 72%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-height: 420px;
  position: relative;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.viewer canvas { display: block; width: 100%; height: 100%; border-radius: var(--radius); }

.views, .tex {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 12px 0 8px;
}

.views figure, .tex figure {
  margin: 0;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.views img, .tex img, .thumb {
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  display: block;
  background: #efe8dc;
}

.views figcaption, .tex figcaption {
  padding: 8px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }

.error { color: var(--warn); font-size: 13px; }

.jobs-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.jobs-table th, .jobs-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.jobs-table th {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: #faf6ef;
}

.jobs-table tr:last-child td { border-bottom: 0; }
.jobs-table a { color: var(--ink); font-weight: 600; text-decoration: none; }
.jobs-table a:hover { color: var(--accent); }

.crumb {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
}

.crumb:hover { color: var(--ink); }

.dl-list { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }
.dl-list a { color: var(--ink); font-size: 13px; }
.dl-list a:hover { color: var(--accent); }

#account {
  display: inline-flex;
  align-items: center;
  gap: 2px;
}

#account .who {
  font-size: 14px;
  font-weight: 600;
  padding: 8px 10px;
}

.nav-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 500 14px Figtree, sans-serif;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}

.nav-btn:hover {
  color: var(--ink);
  background: color-mix(in srgb, #fff 70%, var(--bg));
}

.auth-card {
  max-width: 440px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-card .lede { margin-bottom: 20px; }

.dev-link {
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--accent-soft);
  border-radius: 10px;
  font-size: 13px;
}

.controls > .btn { width: 100%; }

@media (max-width: 800px) {
  .composer, .detail { grid-template-columns: 1fr; }
  main, .top { padding-left: 18px; padding-right: 18px; }
  .composer { padding: 12px; }
}
