:root {
  --bg: #f5f3ef;
  --panel: #ffffff;
  --sunken: #faf9f6;
  --ink: #1c1b19;
  --ink-2: #3d3a35;
  --muted: #7a766e;
  --faint: #a8a39a;
  --line: #e8e4dc;
  --line-2: #d9d4ca;
  --accent: #b5543a;
  --accent-soft: #f6e9e3;
  --open: #c0533a;
  --in-progress: #b5841b;
  --fixed: #2f7d58;
  --verified: #8a8780;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(28, 27, 25, .05), 0 4px 16px rgba(28, 27, 25, .06);
  --shadow-lg: 0 12px 40px rgba(28, 27, 25, .16), 0 2px 6px rgba(28, 27, 25, .06);
  --serif: "New York", ui-serif, "Iowan Old Style", Georgia, serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --header: 60px;
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }
a { color: inherit; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.spacer { flex: 1; }
.row { display: flex; align-items: center; gap: 8px; }
.row.end { justify-content: flex-end; }
.icon { width: 18px; height: 18px; flex: none; }
kbd {
  font: 500 11px/1 var(--mono); color: var(--ink-2); background: var(--panel); border: 1px solid var(--line-2);
  border-bottom-width: 2px; border-radius: 4px; padding: 2px 5px; margin: 0 1px;
}

/* --------------------------------------------------------------------------- controls */

button, select, input, textarea { font: inherit; color: inherit; }
button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: 8px; cursor: pointer; white-space: nowrap;
  border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); font-weight: 500;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
button:hover { background: var(--sunken); border-color: var(--faint); }
button:focus-visible, select:focus-visible, a:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
button:disabled { opacity: .45; cursor: default; }
button.primary { background: var(--ink); border-color: var(--ink); color: #fff; }
button.primary:hover:not(:disabled) { background: #33312d; }
button.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
button.ghost:hover { background: rgba(28, 27, 25, .05); }
button.danger { background: var(--open); border-color: var(--open); color: #fff; }
button.danger:hover { background: #a8442d; }
a.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: 8px; background: var(--ink); color: #fff; font-weight: 500; text-decoration: none;
}
a.button:hover { background: #33312d; }
button.small { height: 26px; padding: 0 9px; font-size: 12.5px; border-radius: 6px; }
.icon-btn { flex: none; width: 34px; padding: 0; border-color: transparent; background: transparent; color: var(--ink-2); }
.icon-btn:hover { background: rgba(28, 27, 25, .06); border-color: transparent; }
.icon-btn.primary { background: var(--ink); color: #fff; border-radius: 50%; width: 38px; height: 38px; }
.icon-btn.primary:hover { background: #33312d; }
.icon-btn.primary .icon { width: 20px; height: 20px; }

input, textarea {
  border: 1px solid var(--line-2); background: var(--panel); border-radius: 8px; padding: 7px 10px;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { width: 100%; resize: vertical; line-height: 1.5; }
::placeholder { color: var(--faint); }

.select { position: relative; display: inline-flex; align-items: center; }
.select select {
  appearance: none; -webkit-appearance: none; cursor: pointer; height: 34px; padding: 0 32px 0 12px;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); font-weight: 500;
}
.select select:hover { border-color: var(--faint); }
.select .chev { position: absolute; right: 9px; width: 16px; height: 16px; pointer-events: none; color: var(--muted); }
.select.small select { height: 30px; padding: 0 26px 0 10px; font-size: 13px; }
.select.small .chev { right: 6px; width: 14px; }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 999px;
  background: rgba(28, 27, 25, .05); color: var(--ink-2); font-size: 12.5px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.chip:empty { display: none; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.pill.draft { background: #fbf1da; color: #8a6210; }
.pill.old { background: rgba(28, 27, 25, .06); color: var(--ink-2); font-weight: 500; }
.pill.old a { color: var(--accent); font-weight: 600; text-decoration: none; }
.pill.old a:hover { text-decoration: underline; }

/* --------------------------------------------------------------------------- header */

header {
  position: sticky; top: 0; z-index: 10; height: var(--header);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
  border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px);
}
.brand { display: flex; border-radius: 7px; }
.brand img { display: block; border-radius: 7px; }
.titles { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
header h1 {
  font: 500 17px/1.2 var(--serif); margin: 0; letter-spacing: .005em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#version-info { color: var(--muted); font-size: 12px; white-space: nowrap; }
#version-picker { position: relative; min-width: 0; }
#stage-bar #versions-menu { left: auto; right: 0; }

#tabs { display: flex; align-self: stretch; gap: 4px; margin-left: 18px; }
#tabs a {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; text-decoration: none;
  color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
#tabs a:hover { color: var(--ink); }
#tabs a.active { color: var(--ink); border-bottom-color: var(--ink); }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
#version-picker summary {
  list-style: none; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 9px 0 12px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: 8px; background: var(--panel); white-space: nowrap;
  transition: border-color .12s, box-shadow .12s;
}
#version-picker summary::-webkit-details-marker { display: none; }
#version-picker summary:hover { border-color: var(--faint); }
#version-picker[open] summary { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#version-name { font-weight: 600; }
#version-label { color: var(--muted); max-width: 240px; overflow: hidden; text-overflow: ellipsis; }
#version-label:empty { display: none; }
#version-picker .chev { width: 16px; height: 16px; color: var(--muted); transition: transform .12s; }
#version-picker[open] .chev { transform: rotate(180deg); }
#versions-menu {
  position: absolute; left: 0; top: calc(100% + 6px); z-index: 20; width: max-content; min-width: 100%; max-width: min(420px, 90vw);
  max-height: 70vh; overflow-y: auto; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
#versions-menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: auto; padding: 7px 10px 7px 8px;
  border: 0; border-radius: 6px; background: none; text-align: left; font-weight: 400;
}
#versions-menu button:hover { background: var(--sunken); }
#versions-menu .tick { width: 16px; height: 16px; color: var(--accent); visibility: hidden; }
#versions-menu [aria-checked="true"] .tick { visibility: visible; }
#versions-menu .what { display: flex; flex-direction: column; flex: 1; min-width: 0; line-height: 1.35; }
#versions-menu .name { display: flex; gap: 8px; overflow: hidden; }
#versions-menu .name span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; }
#versions-menu .when { color: var(--muted); font-size: 12px; }
#versions-menu .pill { height: 20px; font-size: 11px; }
.pill.latest { background: #e3f1e9; color: var(--fixed); }

#account { position: relative; }
#account summary {
  list-style: none; display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 4px 8px 4px 4px; border-radius: 999px; color: var(--ink-2); font-weight: 500;
}
#account summary::-webkit-details-marker { display: none; }
#account summary:hover { background: rgba(28, 27, 25, .05); }
#account .chev { width: 14px; height: 14px; color: var(--muted); }
#account .menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 160px; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
#account .menu a { display: block; padding: 7px 10px; border-radius: 6px; text-decoration: none; }
#account .menu a:hover { background: var(--sunken); }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 28px; height: 28px; border-radius: 50%; background: #8a8780; color: #fff;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
}
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; }

/* --------------------------------------------------------------------------- stage */

main { display: grid; grid-template-columns: minmax(0, 1fr) 400px; height: calc(100vh - var(--header)); }
#app.empty { grid-template-columns: minmax(0, 1fr); }
#app.empty #frame, #app.empty #player, #app.empty #about, #app.empty #side { display: none; }

#stage-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#deliverable-tabs { display: inline-flex; max-width: 100%; overflow-x: auto; }
#deliverable-tabs .tab { flex: none; padding: 0 14px; gap: 6px; }
#deliverable-tabs .tab .n {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; font-size: 11px; line-height: 18px;
  background: var(--accent-soft); color: var(--accent); font-weight: 600;
}
#no-video { display: grid; place-items: center; padding: 48px 0; }
#no-video .card {
  width: min(520px, 100%); text-align: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 36px 32px; box-shadow: var(--shadow);
}
#no-video .card img { border-radius: 10px; }
#no-video h2 { font: 500 21px/1.3 var(--serif); margin: 18px 0 6px; }
#no-video p { color: var(--muted); margin: 0 0 14px; }
#no-video .facts { display: flex; justify-content: center; margin-bottom: 18px; }
#stage { padding: 24px 28px; overflow: auto; display: flex; flex-direction: column; gap: 14px; }
#frame {
  background: #0d0d0c; border-radius: var(--radius); overflow: hidden; display: flex; justify-content: center;
  box-shadow: var(--shadow);
}
#frame video {
  display: block; width: 100%; height: auto; background: #0d0d0c; max-height: calc(100vh - 290px);
  object-fit: contain; cursor: pointer;
}
#frame:fullscreen { border-radius: 0; align-items: center; }
#frame:fullscreen video { max-height: 100vh; }

#player {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px 14px 10px; box-shadow: var(--shadow);
}
#controls { display: flex; align-items: center; gap: 4px; }
#controls #play { margin-right: 6px; }
#clock { white-space: nowrap; display: inline-flex; align-items: baseline; gap: 10px; margin: 0 10px 0 8px; font-variant-numeric: tabular-nums; }
#time { font-weight: 600; font-size: 14px; }
#frame-no { color: var(--muted); font-size: 12.5px; }
#where { max-width: 40%; }

#timeline { position: relative; height: 44px; cursor: pointer; touch-action: none; user-select: none; }
#segments { position: absolute; left: 0; right: 0; top: 18px; height: 16px; border-radius: 4px; overflow: hidden; }
#segments .seg { position: absolute; top: 0; height: 100%; background: #ebe7df; border-right: 1px solid var(--panel); transition: background .1s; }
#segments .seg.odd { background: #e1dcd2; }
#segments .seg.hover { background: #d4cdc0; }
#segments .seg.changed::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--accent);
}
#segments .seg.stale { background-image: repeating-linear-gradient(45deg, transparent 0 4px, rgba(0, 0, 0, .07) 4px 8px); }
#markers { position: absolute; left: 0; right: 0; top: 2px; height: 14px; }
.marker {
  position: absolute; top: 0; width: 12px; height: 12px; padding: 0; margin-left: -6px; border-radius: 50%;
  border: 2px solid var(--panel); background: var(--open); box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
  transition: transform .12s;
}
.marker:hover, .marker.focus { transform: scale(1.35); background: var(--open); border-color: var(--panel); z-index: 1; }
.marker.in_progress, .marker.in_progress:hover { background: var(--in-progress); }
.marker.fixed, .marker.fixed:hover { background: var(--fixed); }
.marker.verified, .marker.wontfix, .marker.verified:hover, .marker.wontfix:hover { background: var(--verified); }
#playhead { position: absolute; top: 14px; bottom: 6px; width: 2px; margin-left: -1px; background: var(--ink); border-radius: 1px; pointer-events: none; }
#playhead::before {
  content: ""; position: absolute; top: -3px; left: -4px; width: 10px; height: 10px; border-radius: 50%;
  background: var(--ink); border: 2px solid var(--panel);
}
#scrub-tip {
  position: absolute; bottom: calc(100% - 6px); transform: translateX(-50%); pointer-events: none; z-index: 2;
  background: var(--ink); color: #fff; font-size: 12px; padding: 4px 8px; border-radius: 6px; white-space: nowrap;
  font-variant-numeric: tabular-nums; box-shadow: var(--shadow);
}
#scrub-tip .dim { color: rgba(255, 255, 255, .6); }

#about { display: flex; flex-direction: column; gap: 14px; }
#release {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px;
  box-shadow: var(--shadow);
}
#release h2 { margin: 0 0 4px; font-size: 13px; font-weight: 600; }
#notes { margin: 0; color: var(--ink-2); white-space: pre-wrap; }
#notes:empty { display: none; }
#changes { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; color: var(--muted); font-size: 12.5px; }
#changes:empty { display: none; }
#changes .chip { cursor: pointer; border: 0; background: var(--accent-soft); color: var(--accent); font-weight: 500; height: 24px; }
#changes .chip:hover { background: #f0d9cf; }
#changes .legend { display: inline-flex; align-items: center; gap: 6px; }
#changes .swatch { width: 14px; height: 4px; border-radius: 2px; background: var(--accent); }
#spec-summary {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px;
}
#spec-summary h2 { margin: 0; font-size: 13px; font-weight: 600; }
#spec-summary a { color: var(--accent); font-size: 12.5px; font-weight: 500; text-decoration: none; }
#spec-summary a:hover { text-decoration: underline; }
#spec-summary p { margin: 6px 0 0; color: var(--ink-2); white-space: pre-wrap; }
.facts { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.facts:empty { display: none; }
.stage {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px;
  background: #e8efe9; color: #2f6447; font-size: 12px; font-weight: 600; white-space: nowrap;
}
#keys { margin: 0; color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
#keys kbd { margin-left: 6px; }
#keys kbd + kbd { margin-left: 0; }
#keys kbd:first-child { margin-left: 0; }

/* --------------------------------------------------------------------------- comments */

#side { border-left: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
#new-comment { padding: 16px 18px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
#new-comment label { font-weight: 600; }
#send { margin-left: auto; }
#comment-at { background: var(--accent-soft); color: var(--accent); font-weight: 500; font-variant-numeric: tabular-nums; }
.hint { color: var(--muted); font-size: 12px; flex: 1; }
.hint kbd { font-size: 10px; padding: 1px 4px; }

.filters { padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--sunken); }
.segmented { display: flex; padding: 3px; background: rgba(28, 27, 25, .06); border-radius: 9px; }
.segmented .tab {
  flex: 1; height: 28px; border: 0; background: transparent; color: var(--muted); border-radius: 7px; font-size: 13px;
}
.segmented .tab:hover { color: var(--ink); background: transparent; }
.segmented .tab.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .08), 0 0 0 1px rgba(0, 0, 0, .03); }
.segmented.compact { padding: 2px; margin-right: 6px; }
.segmented.compact .tab { flex: none; height: 26px; padding: 0 10px; font-size: 12.5px; }
#rendition-note { font-size: 12.5px; margin-right: 8px; }
#download { position: relative; }
#download summary { list-style: none; display: inline-flex; align-items: center; justify-content: center; height: 34px; border-radius: 8px; cursor: pointer; }
#download summary::-webkit-details-marker { display: none; }
#download[open] summary { background: rgba(28, 27, 25, .06); color: var(--ink); }
#download .menu {
  position: absolute; right: 0; bottom: calc(100% + 6px); z-index: 20; width: max-content; padding: 6px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
#download .menu a { display: flex; align-items: baseline; gap: 12px; padding: 7px 10px; border-radius: 6px; text-decoration: none; color: var(--ink); }
#download .menu a:hover { background: var(--sunken); }
#download .menu .muted { margin-left: auto; font-size: 12px; font-variant-numeric: tabular-nums; }
.segmented .n { color: var(--faint); font-weight: 500; font-variant-numeric: tabular-nums; }

#comments { list-style: none; margin: 0; padding: 0; overflow: auto; flex: 1; }
.comment {
  position: relative; padding: 14px 18px 12px; border-bottom: 1px solid var(--line); cursor: pointer;
  transition: background .12s;
}
.comment:hover { background: var(--sunken); }
.comment.focus { background: #fcf6f3; }
.comment.focus::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.comment.resolved .body, .comment.resolved .head strong { color: var(--muted); }
.comment .head { display: flex; align-items: center; gap: 8px; min-width: 0; }
.comment .head strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comment .head .meta { color: var(--muted); font-size: 12px; white-space: nowrap; }
.comment .time {
  margin-left: auto; height: 22px; padding: 0 8px; font-size: 12px; font-weight: 600; border-radius: 6px;
  border: 0; background: rgba(28, 27, 25, .05); color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.comment .time:hover { background: var(--accent-soft); color: var(--accent); }
.comment .tags { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 0 36px; }
.comment .where { color: var(--muted); font-size: 12px; }
.comment .body { margin: 6px 0 0 36px; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }
.comment .actions { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 0 36px; }
.comment .actions button.ghost { color: var(--muted); }
.comment .actions button.ghost:hover { color: var(--ink); }
.more { position: relative; margin-left: auto; }
.more summary {
  list-style: none; display: flex; align-items: center; justify-content: center; width: 28px; height: 26px;
  border-radius: 6px; color: var(--muted); cursor: pointer;
}
.more summary::-webkit-details-marker { display: none; }
.more summary:hover, .more[open] summary { background: rgba(28, 27, 25, .06); color: var(--ink); }
.more .menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 5; min-width: 150px; padding: 5px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-lg);
}
.more .menu button { display: flex; width: 100%; justify-content: flex-start; height: 32px; border: 0; background: none; font-weight: 400; }
.more .menu button:hover { background: var(--sunken); }
.more .menu button.del { color: var(--open); }

.status { font-size: 11.5px; font-weight: 600; color: var(--open); display: inline-flex; align-items: center; gap: 5px; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.in_progress { color: var(--in-progress); }
.status.fixed { color: var(--fixed); }
.status.verified, .status.wontfix { color: var(--verified); }
.changed-badge { font-size: 11.5px; font-weight: 500; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 1px 8px; }

.replies { list-style: none; margin: 10px 0 0 36px; padding: 0; display: grid; gap: 10px; }
.replies li { display: grid; grid-template-columns: 22px 1fr; gap: 2px 8px; }
.replies .avatar { grid-row: span 2; }
.replies .who { font-size: 12.5px; }
.replies .who strong { font-weight: 600; }
.replies .who .meta { color: var(--muted); font-size: 12px; }
.replies .body { margin: 0; }
.replies .held .body { color: var(--muted); font-style: italic; }
.held-tag { font-size: 11px; color: #8a6210; background: #fbf1da; border-radius: 999px; padding: 1px 7px; margin-left: 4px; font-style: normal; }
.reply { margin: 10px 0 0 36px; display: grid; gap: 8px; cursor: default; }
.reply label { color: var(--ink-2); font-size: 12.5px; display: inline-flex; align-items: center; gap: 5px; }
.empty { padding: 48px 24px; text-align: center; color: var(--muted); }
.empty .icon { width: 28px; height: 28px; color: var(--faint); display: block; margin: 0 auto 10px; }
.empty strong { display: block; color: var(--ink-2); font-weight: 600; margin-bottom: 2px; }

.dropping { outline: 2px dashed var(--accent); outline-offset: -6px; background: var(--accent-soft); }
.tray, .attachments { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tray:empty { display: none; }
.tray li, .attachments li { position: relative; display: flex; align-items: center; }
.comment .attachments { margin: 8px 0 0 36px; }
.replies .attachments { grid-column: 2; margin: 4px 0 0; }
.reply .attach span { display: none; }   /* icon only next to the reply's options */
.thumb { display: block; height: 64px; max-width: 160px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: var(--sunken); }
.attachments .thumb { height: 88px; max-width: 220px; transition: border-color .12s; }
.attachments a:hover .thumb { border-color: var(--faint); }
.file {
  display: inline-flex; align-items: center; gap: 4px; max-width: 220px; height: 28px; padding: 0 10px;
  border: 1px solid var(--line-2); border-radius: 6px; background: var(--sunken); font-size: 12.5px; white-space: nowrap; overflow: hidden;
}
.file small { color: var(--muted); }
.attachments a { text-decoration: none; }
.attachments a:hover .file { border-color: var(--faint); }
.tray .uploading { opacity: .55; }
.tray .failed .file { border-color: var(--open); color: var(--open); }
.tray .remove {
  position: absolute; top: -7px; right: -7px; width: 20px; height: 20px; padding: 0; border-radius: 50%;
  background: var(--ink); border-color: var(--panel); color: #fff;
}
.tray .remove:hover { background: #33312d; border-color: var(--panel); }
.tray .remove .icon { width: 12px; height: 12px; }
button.small .icon { width: 15px; height: 15px; }
.comment .body a { color: var(--accent); }


/* --------------------------------------------------------------------------- deliverables */

#deliverables-view { display: block; height: auto; padding: 28px 20px 64px; }
.dv-wrap { max-width: 880px; margin: 0 auto; display: grid; gap: 16px; }
.dv-head { display: flex; align-items: flex-end; gap: 16px; }
.dv-head > div { flex: 1; }
.dv-head h2 { font: 500 26px/1.2 var(--serif); margin: 0 0 4px; }
.dv-head .sub { color: var(--muted); margin: 0; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow);
}
#brief, .card.spec { padding: 18px 20px; display: grid; gap: 10px; }
#brief { background: var(--sunken); box-shadow: none; }
#dv-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 16px; scroll-margin-top: calc(var(--header) + 16px); }
#dv-list > li { scroll-margin-top: calc(var(--header) + 16px); }
#dv-list .empty { display: grid; justify-items: center; gap: 2px; }
.spec-head { display: flex; align-items: center; gap: 10px; min-width: 0; }
.spec-head .num {
  flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); color: #fff; font-size: 12.5px; font-weight: 600;
}
.spec-title { min-width: 0; display: grid; gap: 4px; }
.spec-title h3 { margin: 0; font: 500 19px/1.25 var(--serif); }
.spec-title .muted { color: var(--muted); font-size: 12.5px; }
.spec-head .no-video { color: var(--muted); font-size: 12.5px; }
code.key { font: 11.5px var(--mono); color: var(--muted); background: rgba(28, 27, 25, .05); border-radius: 5px; padding: 1px 6px; }
.spec-body { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); line-height: 1.55; }
.spec-body.none { color: var(--faint); }
.spec-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12.5px; }
.spec-meta button.on { background: rgba(28, 27, 25, .06); color: var(--ink); }

.history { list-style: none; margin: 0; padding: 4px 0 0; border-top: 1px solid var(--line); display: grid; }
.history > li { padding: 10px 0; border-bottom: 1px dashed var(--line); display: grid; gap: 6px; }
.history > li:last-child { border-bottom: 0; }
.rev-head { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.rev-head .meta { color: var(--muted); font-size: 12px; }
.change { display: grid; grid-template-columns: 90px 1fr; gap: 10px; margin-left: 30px; font-size: 13px; }
.change.none { display: block; color: var(--muted); }
.change .field { color: var(--muted); }
.diff { white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); }
.diff del { background: #f9e1da; color: #8f2f1c; text-decoration: line-through; border-radius: 3px; padding: 0 1px; }
.diff ins { background: #dcefe2; color: #1f5c3c; text-decoration: none; border-radius: 3px; padding: 0 1px; }

.spec-form { display: grid; gap: 12px; }
#new-deliverable .spec-form { background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; box-shadow: var(--shadow); }
.spec-form h3 { margin: 0; font: 500 19px/1.25 var(--serif); }
.spec-form .grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.field { display: grid; gap: 4px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--ink-2); }
.spec-form .hint { flex: 1; }

.spec-threads { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 4px; }
.threads-head { display: flex; align-items: baseline; gap: 8px; }
.threads-head h4 { margin: 0; font-size: 13px; font-weight: 600; }
.threads-head .n { color: var(--muted); font-size: 12px; }
.threads { list-style: none; margin: 0 -20px; padding: 0; }
.threads .comment { cursor: default; padding-left: 20px; padding-right: 20px; }
.threads .comment:hover { background: none; }
.threads .comment.focus { background: #fcf6f3; }
.spec-comment { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px; padding-top: 8px; border-radius: 8px; }
.spec-comment .tray { order: 5; flex-basis: 100%; padding-left: 30px; }
.spec-comment .avatar { margin-top: 5px; }
.spec-comment textarea { flex: 1; min-height: 34px; padding: 6px 10px; }
.spec-comment > button { margin-top: 4px; }
.spec-comment .attach span { display: none; }

/* --------------------------------------------------------------------------- message, toasts, dialogs */

#message { min-height: calc(100vh - var(--header)); display: grid; place-items: center; padding: 24px; }
#message .card {
  width: min(420px, 100%); text-align: center; background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 36px 32px; box-shadow: var(--shadow);
}
#message .card img { border-radius: 10px; }
#message h2 { font: 500 21px/1.3 var(--serif); margin: 18px 0 6px; }
#message p { color: var(--muted); margin: 0; }
#message ul { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 6px; text-align: left; }
#message li a {
  display: block; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; font-weight: 500;
}
#message li a:hover { border-color: var(--faint); background: var(--sunken); }
.spinner {
  width: 22px; height: 22px; margin: 22px auto 4px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--ink); animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

#toasts {
  position: fixed; inset: auto auto 20px 50%; transform: translateX(-50%); margin: 0; padding: 0; border: 0;
  background: transparent; overflow: visible; display: grid; gap: 8px; justify-items: center;
}
#toasts:not(:popover-open) { display: none; }
.toast {
  display: flex; align-items: center; gap: 8px; background: var(--ink); color: #fff; padding: 10px 16px;
  border-radius: 10px; box-shadow: var(--shadow-lg); font-weight: 500; animation: toast-in .18s ease-out;
}
.toast.error { background: #8f2f1c; }
.toast .icon { width: 16px; height: 16px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

dialog {
  border: 0; border-radius: 14px; padding: 0; color: var(--ink); background: var(--panel);
  box-shadow: var(--shadow-lg); max-height: 88vh;
}
dialog::backdrop { background: rgba(28, 27, 25, .35); backdrop-filter: blur(2px); }
#confirm { width: min(400px, 92vw); }
#confirm form { padding: 22px; }
#confirm p { margin: 0 0 20px; font-size: 15px; }

#admin { width: min(820px, 95vw); }
#admin[open] { display: flex; flex-direction: column; }
.dialog-head { display: flex; align-items: center; padding: 16px 16px 14px 24px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { margin: 0; flex: 1; font: 500 19px/1.3 var(--serif); }
.dialog-body { padding: 4px 24px 24px; overflow: auto; }
.dialog-body h3 { font-size: 14px; font-weight: 600; margin: 20px 0 2px; }
.dialog-body .sub { color: var(--muted); font-size: 12.5px; margin: 0 0 10px; }
.dialog-body table { width: 100%; border-collapse: collapse; }
.dialog-body th { text-align: left; color: var(--muted); font-weight: 500; font-size: 12px; }
.dialog-body td, .dialog-body th { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.dialog-body td:first-child, .dialog-body th:first-child { padding-left: 0; }
.dialog-body td.actions { text-align: right; white-space: nowrap; }
.dialog-body td.actions button { margin-left: 4px; }
.dialog-body td .muted { color: var(--muted); }
.dialog-body td code { font: 12px var(--mono); color: var(--muted); }
.person { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.renditions { display: flex; flex-direction: column; gap: 4px; }
.renditions > div { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.renditions .kind { min-width: 52px; }
.tag { font-size: 11px; font-weight: 600; color: var(--muted); background: rgba(28, 27, 25, .06); border-radius: 999px; padding: 1px 7px; }
#add-person { margin-top: 12px; flex-wrap: wrap; }
#add-person input:not([type]), #add-person input[type=email] { flex: 1; min-width: 140px; }
label.check { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); }
#link-out {
  margin-top: 12px; background: var(--accent-soft); border-radius: 8px; padding: 10px 12px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
#link-out span { font-size: 12.5px; color: var(--ink-2); }
#link-out code { flex: 1; font: 12px var(--mono); overflow-wrap: anywhere; min-width: 200px; }

/* --------------------------------------------------------------------------- small screens */

@media (max-width: 1100px) {
  main { grid-template-columns: minmax(0, 1fr) 340px; }
  #stage { padding: 18px; }
}
@media (max-width: 900px) {
  :root { --header: auto; }
  header { flex-wrap: wrap; padding: 10px 14px; gap: 10px; height: auto; }
  #tabs { order: 5; width: 100%; margin: 0; }
  #tabs a { padding: 8px 12px; }
  #version-picker { flex: 1; }
  #deliverables-view { padding: 18px 12px 48px; }
  .dv-head { flex-wrap: wrap; align-items: flex-start; }
  .spec-head { flex-wrap: wrap; }
  .spec-form .grid { grid-template-columns: minmax(0, 1fr); }
  .change { grid-template-columns: minmax(0, 1fr); gap: 2px; margin-left: 0; }
  #version-picker summary { width: 100%; }
  #version-picker .chev { margin-left: auto; }
  #versions-menu { width: 100%; max-width: none; }
  #admin-open span, #who { display: none; }
  main { display: block; height: auto; }
  #stage { padding: 12px; overflow: visible; }
  #side { border-left: 0; border-top: 1px solid var(--line); }
  #comments { overflow: visible; }
  #frame video { max-height: 60vh; }
  #frame-no, #keys, .hint { display: none; }
  #where { max-width: 45%; }
  #clock { margin: 0 4px; }
  #controls { gap: 2px; }
  #message { min-height: 80vh; }
}
@media (max-width: 520px) {
  #where { display: none; }   /* the comment box names the spread */
}
