:root {
  color-scheme: light dark;
  --bg: #ffffff;
  --fg: #1c1c1e;
  --muted: #6e6e73;
  --line: #e2e2e5;
  --soft: #f4f4f6;
  --accent: #0a5bd3;
  --danger: #b3261e;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131315;
    --fg: #ececee;
    --muted: #98989f;
    --line: #2c2c30;
    --soft: #1d1d20;
    --accent: #7eaaff;
    --danger: #ff8b82;
  }
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  -webkit-text-size-adjust: 100%;
}
main { max-width: 720px; margin: 0 auto; padding: 24px 16px 80px; }
h1 { font-size: 1.5rem; margin: 0; }
h2 { font-size: 1.15rem; margin: 0; }
h3 { font-size: 1rem; margin: 0; }
a { color: var(--accent); }
.muted { color: var(--muted); font-size: 0.875rem; }
.error { color: var(--danger); font-size: 0.875rem; margin: 4px 0 0; }
.error:empty { display: none; }
[hidden] { display: none !important; }

header.top {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding-bottom: 12px; margin-bottom: 24px; border-bottom: 1px solid var(--line);
}
header.top nav { display: flex; gap: 16px; font-size: 0.9rem; white-space: nowrap; }

/* --- forms & buttons --- */
input, textarea, button { font: inherit; color: inherit; }
input[type="text"], input[type="password"], input[type="date"], textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--bg);
}
textarea { min-height: 4.5em; resize: vertical; }
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
label { display: block; font-size: 0.875rem; color: var(--muted); margin: 10px 0 4px; }
button {
  padding: 7px 14px; border: 1px solid var(--line); border-radius: 6px;
  background: var(--soft); cursor: pointer;
}
button.primary { background: var(--accent); border-color: var(--accent); color: var(--bg); }
button:disabled { opacity: 0.55; cursor: default; }
button.link {
  padding: 0; border: 0; background: none; color: var(--accent); text-decoration: underline;
  font-size: 0.875rem;
}
button.link.danger { color: var(--danger); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.row > input { flex: 1; width: auto; min-width: 0; }
.actions { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.875rem; }
form.box, .box { border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 16px 0; }
progress { width: 100%; height: 8px; }

/* --- login --- */
.login { max-width: 340px; margin: 18vh auto 0; }
.login h1 { margin-bottom: 16px; }

/* --- lists --- */
ul.plain { list-style: none; margin: 0; padding: 0; }
.client-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.client-row .meta { text-align: right; white-space: nowrap; }

/* --- tracks & versions --- */
.track { margin: 0 0 32px; }
.track > header { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
details.version { border: 1px solid var(--line); border-radius: 8px; margin: 8px 0; }
details.version > summary {
  cursor: pointer; padding: 10px 14px; display: flex; justify-content: space-between; gap: 12px;
  list-style: none;
}
details.version > summary::-webkit-details-marker { display: none; }
details.version > summary::before { content: "▸"; color: var(--muted); margin-right: 2px; }
details.version[open] > summary::before { content: "▾"; }
details.version > summary .label { flex: 1; font-weight: 600; }
.version-body { padding: 0 14px 14px; }
.file { margin: 10px 0 14px; }
.file .row { margin-top: 4px; justify-content: space-between; }
audio { width: 100%; margin-top: 4px; }

/* --- comments --- */
.comments { border-top: 1px solid var(--line); margin-top: 8px; padding-top: 8px; }
.comment { padding: 8px 0; }
.comment .who { font-weight: 600; font-size: 0.875rem; }
.comment .text { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.comment.admin .who { color: var(--accent); }

@media (max-width: 480px) {
  main { padding-top: 16px; }
  .client-row { flex-direction: column; gap: 2px; }
  .client-row .meta { text-align: left; }
}
