:root {
  color-scheme: dark;
  --bg: #0c0e12;
  --bg-elevated: #13161d;
  --bg-hover: #1a1f2a;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #e8eaef;
  --text-muted: #8b93a7;
  --text-faint: #5c6478;
  --accent: #6ee7b7;
  --accent-dim: rgba(110, 231, 183, 0.12);
  --accent-glow: rgba(110, 231, 183, 0.25);
  --blue: #60a5fa;
  --amber: #fbbf24;
  --red: #f87171;
  --green: #4ade80;
  --radius: 8px;
  --radius-sm: 6px;
  --font: 'DM Sans', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.25);
  --topbar-h: 52px;
}

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

html {
  font-size: 13px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.45;
  color: var(--text);
  background:
    radial-gradient(ellipse 80% 50% at 50% -20%, rgba(110, 231, 183, 0.08), transparent),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, p {
  margin: 0;
}

button, input, select {
  font: inherit;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 1rem 1.5rem;
}

/* ── Top bar ── */

.topbar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: var(--topbar-h);
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  position: relative;
  z-index: 2;
}

.brand-mark {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand h1 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 0.85rem;
  color: var(--text-faint);
  margin-top: 1px;
}

.service-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.service-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-faint);
  flex-shrink: 0;
}

.service-pill.ok .service-dot {
  background: var(--green);
  box-shadow: 0 0 6px var(--green);
}

.service-pill.ok {
  color: var(--text-muted);
  border-color: rgba(74, 222, 128, 0.2);
}

.service-pill.error .service-dot {
  background: var(--red);
  box-shadow: 0 0 6px var(--red);
}

.service-pill.error {
  color: #fca5a5;
  border-color: rgba(248, 113, 113, 0.25);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
  position: relative;
  z-index: 2;
  margin-left: auto;
}

.main-nav {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  z-index: 1;
}

.main-nav-link {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid transparent;
}

.main-nav-link:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.main-nav-link.is-active {
  color: var(--text);
  background: var(--bg-elevated);
  border-color: var(--border-strong);
}

.panel-sub {
  margin-top: 0.2rem;
  font-size: 0.82rem;
  color: var(--text-faint);
}

.reviews-page {
  max-width: 960px;
  margin: 0 auto;
}

.reviews-page-grid {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.panel-empty {
  padding: 2rem 1rem;
  text-align: center;
}

.review-job-list {
  padding: 0.35rem 0.75rem 0.65rem;
}

.review-list-row {
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid transparent;
}

.review-list-row:hover {
  background: var(--bg-hover);
  border-color: var(--border);
}

.review-list-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.review-list-title {
  font-weight: 500;
  font-size: 0.95rem;
  line-height: 1.35;
  word-break: break-word;
}

.review-unavailable {
  font-size: 0.78rem;
}

/* ── Auth gate ── */

.auth-gate {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1.5rem;
}

.auth-card {
  width: 100%;
  max-width: 360px;
  padding: 1.75rem;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.auth-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.auth-brand h1 {
  font-size: 1.35rem;
  font-weight: 600;
}

.auth-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-error {
  color: #fca5a5;
}

/* ── Layout ── */

.layout {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 920px) {
  .layout {
    grid-template-columns: 280px 1fr;
    align-items: start;
  }
}

.main {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-width: 0;
}

/* ── Panels ── */

.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-head {
  padding: 0.6rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.panel-head h2 {
  font-size: 0.9rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel-head-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.panel-submit {
  position: sticky;
  top: 0.5rem;
}

/* ── Form ── */

.compact-form {
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.field-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.field-group-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin: 0.35rem 0 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.field-row-4 {
  grid-template-columns: 1fr 1fr;
}

@media (min-width: 920px) {
  .field-row-4 {
    grid-template-columns: 1fr 1fr;
  }
}

.field-check {
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  cursor: pointer;
}

.field-check input {
  width: auto;
  margin: 0;
}

input[type='text'],
input[type='number'],
input[type='file'],
select {
  width: 100%;
  padding: 0.4rem 0.55rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
select:focus {
  border-color: rgba(110, 231, 183, 0.45);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

input[type='file'] {
  padding: 0.35rem;
  font-size: 0.85rem;
}

input[type='file']::file-selector-button {
  padding: 0.25rem 0.5rem;
  margin-right: 0.5rem;
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  background: var(--bg-hover);
  color: var(--text-muted);
  font-size: 0.82rem;
  cursor: pointer;
}

.input-row {
  display: flex;
  gap: 0.35rem;
}

.input-row input {
  flex: 1;
  min-width: 0;
}

.advanced {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.advanced summary {
  padding: 0.4rem 0.55rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.advanced summary::-webkit-details-marker {
  display: none;
}

.advanced summary::before {
  content: '▸ ';
  font-size: 0.75rem;
  color: var(--text-faint);
}

.advanced[open] summary::before {
  content: '▾ ';
}

.advanced-body {
  padding: 0.55rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: rgba(0, 0, 0, 0.15);
}

.form-note {
  font-size: 0.85rem;
  margin: 0;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
}

.form-note.success {
  color: var(--accent);
  background: var(--accent-dim);
}

.form-note.error {
  color: #fca5a5;
  background: rgba(248, 113, 113, 0.1);
}

/* ── Buttons ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.92rem;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: linear-gradient(180deg, #6ee7b7 0%, #34d399 100%);
  color: #052e1a;
  border-color: rgba(110, 231, 183, 0.3);
}

.btn-primary:hover {
  filter: brightness(1.06);
}

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

.btn-ghost {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text);
}

.btn-danger {
  color: #fca5a5;
}

.btn-danger:hover {
  background: rgba(248, 113, 113, 0.12);
  border-color: rgba(248, 113, 113, 0.35);
  color: #fecaca;
}

.btn-sm {
  padding: 0.25rem 0.55rem;
  font-size: 0.82rem;
}

.btn-block {
  width: 100%;
  margin-top: 0.25rem;
}

/* ── Queue ── */

.panel-queue {
  overflow: hidden;
}

.review-open-btn {
  flex-shrink: 0;
}

.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  flex-shrink: 0;
}

.review-export-icon {
  width: 0.95rem;
  height: 0.95rem;
  display: block;
}

.review-export-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.review-diag-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.review-diag-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.queue-grid {
  display: grid;
  gap: 0;
}

@media (min-width: 640px) {
  .queue-grid {
    grid-template-columns: 1fr 1fr;
  }

  .queue-col-wide {
    grid-column: 1 / -1;
    border-top: 1px solid var(--border);
  }
}

.queue-col {
  padding: 0.65rem 0.75rem;
  min-height: 4.5rem;
}

@media (min-width: 640px) {
  .queue-col:first-child {
    border-right: 1px solid var(--border);
  }
}

.queue-title {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin-bottom: 0.5rem;
}

.queue-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.queue-dot.running {
  background: var(--amber);
  box-shadow: 0 0 8px rgba(251, 191, 36, 0.5);
}

.queue-dot.queued {
  background: var(--blue);
  box-shadow: 0 0 8px rgba(96, 165, 250, 0.35);
}

.queue-dot.recent {
  background: var(--green);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.35);
}

.job-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.job-list-compact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.35rem;
}

.job-row {
  width: 100%;
  text-align: left;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.job-row:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
}

.job-row:focus-visible {
  outline: 2px solid var(--accent-dim);
  outline-offset: 1px;
}

.job-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.job-row-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

.job-row-badges {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.25rem;
}

.btn-cancel {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.35rem;
  height: 1.35rem;
  padding: 0;
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 4px;
  background: rgba(248, 113, 113, 0.1);
  color: var(--red);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
}

.btn-cancel:hover {
  background: rgba(248, 113, 113, 0.22);
  border-color: rgba(248, 113, 113, 0.55);
}

.job-title-wrap {
  display: flex;
  align-items: baseline;
  gap: 0.45rem;
  min-width: 0;
  flex: 1;
}

.job-row .job-title {
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-row .job-id {
  font-family: var(--mono);
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text);
  flex-shrink: 0;
}

.job-title-wrap .job-id {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-faint);
}

.job-row .job-meta {
  font-size: 0.78rem;
  color: var(--text-faint);
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.job-row .job-progress {
  font-family: var(--mono);
  font-size: 0.75rem;
  color: var(--amber);
  margin-top: 0.3rem;
  line-height: 1.35;
}

.job-row.status-processing {
  border-left: 2px solid var(--amber);
}

.job-row.status-pending {
  border-left: 2px solid var(--blue);
}

.job-row.status-done {
  border-left: 2px solid var(--green);
}

.job-row.status-failed {
  border-left: 2px solid var(--red);
}

.job-row.status-cancelled {
  border-left: 2px solid var(--text-faint);
  opacity: 0.85;
}

.empty-note {
  font-size: 0.82rem;
  color: var(--text-faint);
  font-style: italic;
  margin: 0;
}

.empty-note[hidden] {
  display: none;
}

/* ── Status badges ── */

.badge {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  font-family: var(--mono);
  font-size: 0.68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.badge.pending {
  background: rgba(96, 165, 250, 0.15);
  color: var(--blue);
}

.badge.processing {
  background: rgba(251, 191, 36, 0.15);
  color: var(--amber);
}

.badge.done {
  background: rgba(74, 222, 128, 0.15);
  color: var(--green);
}

.badge.failed {
  background: rgba(248, 113, 113, 0.15);
  color: var(--red);
}

.badge.cancelled {
  background: rgba(139, 147, 167, 0.15);
  color: var(--text-muted);
}

/* ── Detail panel ── */

.panel-detail {
  animation: slideIn 0.2s ease-out;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.detail-body {
  padding: 0.75rem;
}

.detail-meta {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  line-height: 1.5;
}

.detail-meta code {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--accent);
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.65rem;
}

.detail-meta-row .btn {
  margin-left: auto;
}

#detail-heading {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.progress-line {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.45rem 0.6rem;
  background: rgba(251, 191, 36, 0.08);
  border: 1px solid rgba(251, 191, 36, 0.15);
  border-radius: var(--radius-sm);
  color: var(--amber);
  margin-bottom: 0.75rem;
}

.detail-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-faint);
  margin: 0.85rem 0 0.45rem;
}

.detail-section-title:first-child {
  margin-top: 0;
}

.stage-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.stage-table th,
.stage-table td {
  padding: 0.35rem 0.5rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.stage-table th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.stage-table td:last-child {
  font-family: var(--mono);
  color: var(--text-muted);
}

.stage-table tfoot .stage-total td {
  border-top: 1px solid var(--border-strong);
  border-bottom: none;
  font-weight: 600;
  color: var(--text);
}

.stage-table tfoot .stage-total td:last-child {
  color: var(--accent);
}

.dialogue-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dialogue-item {
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1px solid var(--border);
}

.dialogue-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dialogue-speaker {
  font-size: 0.82rem;
  font-weight: 600;
}

.dialogue-time {
  font-size: 0.72rem;
  color: var(--text-faint);
  font-family: var(--mono);
}

.dialogue-text {
  margin: 0.35rem 0 0;
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
}

.diagnostics-summary {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 0.45rem 0.6rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  line-height: 1.45;
}

.error-panel {
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.25);
  color: #fca5a5;
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
}

.debug-block {
  margin-top: 0.45rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.debug-block summary {
  padding: 0.4rem 0.55rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  background: var(--bg);
  user-select: none;
}

.debug-block-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.debug-block-summary .btn-copy-json {
  flex-shrink: 0;
}

.btn-copy-json.copied {
  color: var(--accent);
  border-color: rgba(110, 231, 183, 0.35);
}

.debug-block pre {
  margin: 0;
  padding: 0.55rem;
  max-height: 18rem;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.45;
  background: rgba(0, 0, 0, 0.25);
  color: var(--text-muted);
}

.empty-inline {
  font-size: 0.82rem;
  color: var(--text-faint);
  font-style: italic;
}

.badge.annotation {
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.3);
}

.badge.annotation.reviewed,
.badge.reviewed {
  background: rgba(110, 231, 183, 0.15);
  color: #6ee7b7;
  border: 1px solid rgba(110, 231, 183, 0.3);
}

.badge.annotation.approved,
.badge.approved,
.badge.annotation.gold,
.badge.gold {
  background: rgba(212, 175, 55, 0.18);
  color: #e8c547;
  border: 1px solid rgba(212, 175, 55, 0.45);
}

.badge.annotation.draft,
.badge.draft {
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.3);
}

.badge.annotation.in_progress,
.badge.in_progress {
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.3);
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0 0 0.85rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
}

.review-app .topbar {
  margin-bottom: 0;
  height: auto;
  min-height: var(--topbar-h);
  padding: 0.65rem 0 0.5rem;
  border-bottom: none;
}

.review-sticky-head {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 -1rem;
  padding: 0 1rem 0.75rem;
  background-color: var(--bg);
  background-image:
    radial-gradient(
      ellipse 80% 50% at 50% -20%,
      rgba(110, 231, 183, 0.08),
      transparent
    );
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

.review-sticky-head .review-player-panel {
  padding: 0.5rem 0.75rem 0;
}

.review-layout {
  display: grid;
  gap: 1rem;
  padding-top: 0.25rem;
}

.review-player-panel,
.review-editor-panel {
  padding: 1rem;
}

.waveform {
  min-height: 96px;
  border-radius: var(--radius-sm);
  background: rgba(0, 0, 0, 0.25);
  margin-bottom: 0.75rem;
}

.review-player-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  padding: 0 0.15rem 0.65rem;
}

.unassigned-warning-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  height: 1.9rem;
  padding: 0 0.65rem;
  border-radius: 999px;
  border: 1px solid rgba(251, 191, 36, 0.45);
  background: rgba(251, 191, 36, 0.12);
  color: #fbbf24;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

.unassigned-warning-btn:hover {
  background: rgba(251, 191, 36, 0.2);
  border-color: rgba(251, 191, 36, 0.65);
}

.unassigned-warning-btn[hidden] {
  display: none !important;
}

.unassigned-warning-icon {
  font-size: 0.95rem;
  line-height: 1;
}

.review-player-controls #play-btn,
.review-player-controls #playback-rate {
  height: 1.9rem;
  box-sizing: border-box;
}

.review-player-controls #play-btn {
  padding: 0 0.75rem;
  font-size: 0.82rem;
}

.review-player-controls #playback-rate {
  padding: 0 0.5rem;
  font: inherit;
  font-size: 0.82rem;
  line-height: 1;
  color: var(--text);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
}

.inline-field {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
}

.inline-field .field-label {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.mono {
  font-family: var(--mono);
  font-size: 0.85rem;
}

.text-muted {
  color: var(--text-muted);
}

.save-status {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.save-status.saved {
  color: #6ee7b7;
}

.save-status.saving,
.save-status.pending {
  color: #fbbf24;
}

.save-status.error {
  color: #fca5a5;
}

.review-sticky-head .review-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.review-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.speakers-editor {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  white-space: nowrap;
}

.speakers-editor-label {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

.speakers-editor-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  height: 1.75rem;
  min-width: 8.5rem;
  padding: 0 0.45rem;
  box-sizing: border-box;
}

.speaker-color-control {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.speaker-color-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  padding: 0;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
}

.speaker-color-swatch:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.speaker-color-palette {
  position: absolute;
  top: calc(100% + 0.4rem);
  left: 0;
  z-index: 60;
  display: grid;
  grid-template-columns: repeat(4, 1.35rem);
  gap: 0.35rem;
  padding: 0.5rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.speaker-color-palette[hidden] {
  display: none !important;
}

.speaker-color-option {
  width: 1.35rem;
  height: 1.35rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  padding: 0;
  cursor: pointer;
}

.speaker-color-option:hover {
  transform: scale(1.08);
}

.speaker-color-option.selected {
  box-shadow:
    0 0 0 2px var(--bg-elevated),
    0 0 0 3px rgba(255, 255, 255, 0.85);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal[hidden] {
  display: none !important;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
}

.modal-dialog {
  position: relative;
  z-index: 1;
  width: min(22rem, 100%);
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal-title {
  font-size: 1rem;
  font-weight: 600;
}

.modal-dialog .field {
  gap: 0.35rem;
}

.modal-dialog input[type="text"] {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  padding: 0.45rem 0.55rem;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

.turn-card.speaker-missing {
  border-color: rgba(248, 113, 113, 0.7);
  background: rgba(248, 113, 113, 0.08);
  box-shadow: inset 0 0 0 1px rgba(248, 113, 113, 0.25);
}

.turn-card.validation-error {
  border-color: rgba(251, 146, 60, 0.85);
  background: rgba(251, 146, 60, 0.12);
  box-shadow:
    inset 0 0 0 1px rgba(251, 146, 60, 0.35),
    0 0 0 2px rgba(251, 146, 60, 0.25);
}

.turn-card.speaker-missing select[data-field="speaker"] {
  border-color: rgba(248, 113, 113, 0.65);
  color: #fca5a5;
}

.turns-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.turn-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.65rem;
  background: var(--bg);
}

.turn-card.selected {
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.2);
}

.turn-card.playhead-active {
  border-color: rgba(110, 231, 183, 0.65);
  box-shadow: 0 0 0 1px rgba(110, 231, 183, 0.35);
  background: rgba(110, 231, 183, 0.06);
}

.turn-card.selected.playhead-active {
  border-color: rgba(110, 231, 183, 0.75);
  box-shadow:
    0 0 0 1px rgba(110, 231, 183, 0.4),
    0 0 0 3px rgba(96, 165, 250, 0.2);
}

.turn-card-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.45rem;
}

.turn-color {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.turn-seek-btn,
.turn-split-here-btn {
  padding: 0.15rem 0.45rem;
  font-size: 0.75rem;
  line-height: 1.2;
  white-space: nowrap;
  flex-shrink: 0;
}

.turn-card select,
.turn-card input[type="number"],
.turn-card textarea {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
  padding: 0.25rem 0.4rem;
}

.turn-card input[type="number"] {
  width: 5.5rem;
  font-family: var(--mono);
  font-size: 0.82rem;
}

.turn-card textarea {
  width: 100%;
  resize: vertical;
  min-height: 2.5rem;
}

.turn-split-here-btn[hidden] {
  display: none !important;
}

.turn-flag {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (min-width: 960px) {
  .review-layout {
    grid-template-columns: 1fr;
  }
}

