/* Setlist: a quiet tool page. Light and dark through custom properties. */

:root {
  color-scheme: light dark;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --text: #1c1c1a;
  --muted: #5f5f5a;
  --line: #dcdcd6;
  --line-strong: #b9b9b1;
  --accent: #1f5fbf;
  --accent-text: #ffffff;
  --focus: #1f5fbf;
  --check-bg: #fff6dc;
  --check-line: #b07a00;
  --check-text: #6b4a00;
  --ok-text: #1d6b3a;
  --ok-bg: #e5f3ea;
  --error-text: #a3221b;
  --error-bg: #fbe9e7;
  --run-text: #1f4f94;
  --run-bg: #e6eefa;
  --radius: 6px;
  --gap: 1rem;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 100%;
  line-height: 1.45;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615;
    --surface: #1f1f1d;
    --text: #ebebe6;
    --muted: #a3a39b;
    --line: #34342f;
    --line-strong: #4d4d46;
    --accent: #6ea3f2;
    --accent-text: #0e1a2c;
    --focus: #8db8f7;
    --check-bg: #33290f;
    --check-line: #d9a63a;
    --check-text: #f1cf86;
    --ok-text: #8fd6a6;
    --ok-bg: #173323;
    --error-text: #f2a39c;
    --error-bg: #3a1a17;
    --run-text: #a9c8f6;
    --run-bg: #1c2b42;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
}

h1,
h2 {
  line-height: 1.2;
  margin: 0 0 0.75rem;
}

h1 {
  font-size: 1.5rem;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 1.1rem;
}

h1:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip {
  position: absolute;
  left: 0.5rem;
  top: -3rem;
  padding: 0.5rem 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  z-index: 10;
}

.skip:focus {
  top: 0.5rem;
}

/* ---- frame ---------------------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--gap);
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  color: var(--text);
  font-weight: 650;
  text-decoration: none;
}

.account {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  font-size: 0.9rem;
  color: var(--muted);
}

.who {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

main {
  max-width: 60rem;
  margin: 0 auto;
  padding: 1.5rem 1rem 4rem;
}

main:focus {
  outline: none;
}

.narrow {
  max-width: 24rem;
  margin: 2rem auto 0;
}

.loading,
.empty,
.hint,
.meta,
.or,
.summary {
  color: var(--muted);
}

.meta {
  margin: -0.25rem 0 1rem;
  overflow-wrap: anywhere;
}

.back {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.panel > :last-child {
  margin-bottom: 0;
}

.hint {
  margin: 0 0 1rem;
  font-size: 0.95rem;
}

/* ---- forms ---------------------------------------------------------------------------- */
.stack {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.85rem;
}

.field {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.3rem;
}

label {
  font-weight: 550;
  font-size: 0.95rem;
}

input[type="email"],
input[type="password"],
input[type="text"],
input[type="url"],
textarea {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.5rem 0.6rem;
}

input[type="file"] {
  font: inherit;
  width: 100%;
}

textarea {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.9rem;
  resize: vertical;
  min-height: 10rem;
}

.or {
  margin: -0.25rem 0;
  font-size: 0.9rem;
}

.check {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}

.check input {
  margin-top: 0.3rem;
  width: 1rem;
  height: 1rem;
}

.check label {
  font-weight: 400;
}

button {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 0.45rem 0.9rem;
  min-height: 2.25rem;
  cursor: pointer;
}

button:hover {
  border-color: var(--text);
}

button:disabled {
  opacity: 0.55;
  cursor: default;
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

button.primary:hover {
  filter: brightness(1.08);
}

button.primary.is-done {
  background: var(--ok-bg);
  border-color: var(--ok-text);
  color: var(--ok-text);
}

button.small {
  padding: 0.25rem 0.65rem;
  min-height: 2rem;
  font-size: 0.9rem;
}

.link-button {
  border: none;
  background: none;
  color: var(--accent);
  padding: 0.25rem;
  min-height: 0;
  text-decoration: underline;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.error {
  margin: 0;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--error-text);
  background: var(--error-bg);
  color: var(--error-text);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.note,
.warning {
  margin: 0 0 1rem;
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--check-line);
  background: var(--check-bg);
  color: var(--check-text);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.warning .tag {
  margin-right: 0.35rem;
}

/* ---- progress ------------------------------------------------------------------------- */
progress {
  width: 100%;
  height: 0.6rem;
  accent-color: var(--accent);
}

.upload {
  display: grid;
  gap: 0.4rem;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.upload label {
  font-weight: 500;
  overflow-wrap: anywhere;
}

.upload button {
  justify-self: start;
}

.progress-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.pct {
  min-width: 3.5rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 0.9rem;
}

/* ---- status tags ---------------------------------------------------------------------- */
.status,
.tag {
  display: inline-block;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-running {
  color: var(--run-text);
  background: var(--run-bg);
  border-color: transparent;
}

.status-done {
  color: var(--ok-text);
  background: var(--ok-bg);
  border-color: transparent;
}

.status-failed {
  color: var(--error-text);
  background: var(--error-bg);
  border-color: transparent;
}

.status-queued,
.status-cancelled {
  color: var(--muted);
}

.state-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
}

.state-text {
  color: var(--muted);
  font-size: 0.92rem;
}

.state {
  display: grid;
  gap: 0.6rem;
}

.reason {
  margin: 0;
}

/* ---- the list of sets ----------------------------------------------------------------- */
.jobs {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.job {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(12rem, 22rem);
  gap: 0.4rem 1.25rem;
  padding: 0.75rem 0.25rem;
  border-bottom: 1px solid var(--line);
}

.job-main {
  display: grid;
  align-content: start;
  gap: 0.15rem;
  min-width: 0;
}

.job-title {
  font-weight: 600;
  overflow-wrap: anywhere;
}

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

.job-state {
  display: grid;
  gap: 0.35rem;
  align-content: start;
}

/* ---- entries -------------------------------------------------------------------------- */
.summary {
  margin: 0 0 0.75rem;
}

.entries {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.entry {
  padding: 0.55rem 0.5rem 0.55rem 0.75rem;
  border-bottom: 1px solid var(--line);
  border-left: 3px solid transparent;
  display: grid;
  gap: 0.35rem;
}

.entry.needs-check {
  background: var(--check-bg);
  border-left-color: var(--check-line);
}

.entry-line {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr) auto;
  gap: 0.25rem 0.75rem;
  align-items: baseline;
}

.time {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.name {
  font-weight: 550;
  overflow-wrap: anywhere;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 0.35rem;
}

.tag-check {
  color: var(--check-text);
  border-color: var(--check-line);
}

.tag-check::before {
  content: "! ";
}

.conf {
  font-weight: 500;
  color: var(--muted);
}

.conf-confirmed {
  color: var(--ok-text);
  border-color: var(--ok-text);
}

.clips {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
}

.entry-note,
.candidates,
.entry-actions,
.edit {
  margin: 0 0 0 5.25rem;
}

.entry-note {
  font-size: 0.9rem;
  color: var(--check-text);
}

.candidates {
  font-size: 0.92rem;
}

.candidates-title {
  margin: 0 0 0.25rem;
  color: var(--muted);
}

.candidates ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.3rem;
}

.candidates li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.25rem 0.5rem;
}

.candidates .at {
  color: var(--muted);
}

.entry-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.conf-confirmed::before {
  content: "\2713 ";
}

.edit {
  display: grid;
  gap: 0.6rem;
  padding: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
}

.edit-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.6rem;
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

h2:focus,
.entry:focus {
  outline: none;
}

.entry:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.state-block {
  display: grid;
  gap: 0.35rem;
}

/* ---- narrow screens ------------------------------------------------------------------- */
@media (max-width: 40rem) {
  main {
    padding: 1rem 0.75rem 3rem;
  }

  .job {
    grid-template-columns: minmax(0, 1fr);
  }

  .entry-line {
    grid-template-columns: 3.75rem minmax(0, 1fr);
  }

  .tags {
    grid-column: 2;
    justify-content: flex-start;
  }

  .entry-note,
  .candidates,
  .entry-actions,
  .edit {
    margin-left: 0;
  }

  .edit-fields {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
