:root {
  color-scheme: light;
  font-family: Inter, "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #17202a;
  background: #f4f6f8;
  letter-spacing: 0;
  --ink: #17202a;
  --muted: #647181;
  --line: #dce2e7;
  --panel: #ffffff;
  --accent: #c84b31;
  --accent-dark: #9d3420;
  --green: #16784a;
  --blue: #2667a8;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
button, input { font: inherit; }
button { cursor: pointer; }

.topbar {
  height: 72px;
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
  background: #17202a;
  border-bottom: 4px solid var(--accent);
}
.topbar h1 { margin: 0; font-size: 22px; line-height: 1.1; }
.eyebrow { margin: 0 0 4px; font-size: 10px; color: #a9b4bf; font-weight: 700; }
.icon-button { width: 40px; height: 40px; border: 1px solid #52606d; background: transparent; color: white; font-size: 24px; }

main { max-width: 1440px; margin: 0 auto; }
.upload-band {
  min-height: 132px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 28px 32px;
  background: #e8edf1;
  border-bottom: 1px solid var(--line);
}
.upload-band h2, .section-heading h2 { margin: 0; font-size: 18px; }
.upload-band p { margin: 8px 0 0; color: var(--muted); }
.upload-button, .primary-button, .secondary-button, .danger-button {
  min-height: 42px;
  padding: 10px 18px;
  border: 1px solid transparent;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.upload-button, .primary-button { background: var(--accent); color: white; }
.upload-button:hover, .primary-button:hover { background: var(--accent-dark); }
.primary-button:disabled { background: #aeb7bf; cursor: not-allowed; }
.secondary-button { background: white; border-color: #aeb7bf; color: var(--ink); }
.danger-button { background: white; border-color: #ca5b4b; color: #9c2f20; }
.progress { grid-column: 1 / -1; height: 5px; background: #cbd3da; overflow: hidden; }
.progress span { display: block; width: 40%; height: 100%; background: var(--accent); animation: loading 1.2s infinite ease-in-out; }
@keyframes loading { 0% { transform: translateX(-100%); } 100% { transform: translateX(350%); } }

.workspace { display: grid; grid-template-columns: 320px minmax(0, 1fr); min-height: calc(100vh - 204px); }
aside { border-right: 1px solid var(--line); background: #f8fafb; }
.section-heading { height: 56px; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.section-heading span { color: var(--muted); font-variant-numeric: tabular-nums; }
.task-list { display: grid; }
.task-item { text-align: left; border: 0; border-bottom: 1px solid var(--line); background: transparent; padding: 16px 20px; }
.task-item:hover, .task-item.active { background: white; box-shadow: inset 4px 0 var(--accent); }
.task-title { display: block; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-meta { display: flex; justify-content: space-between; gap: 8px; margin-top: 8px; color: var(--muted); font-size: 12px; }
.status { font-weight: 700; color: var(--blue); }
.status.ready { color: var(--green); }
.status.error { color: var(--accent-dark); }

.detail { min-width: 0; padding: 28px 32px 56px; background: var(--panel); }
.detail.empty { display: grid; place-items: center; }
.empty-state { display: grid; gap: 8px; text-align: center; color: var(--muted); }
.empty-state strong { color: var(--ink); }
.detail-header { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.detail-header h2 { margin: 0 0 8px; font-size: 24px; overflow-wrap: anywhere; }
.detail-header p { margin: 0; color: var(--muted); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.phase { margin: 24px 0; padding: 14px 16px; border-left: 4px solid var(--blue); background: #eef5fb; color: #234c73; }
.phase.error { border-color: var(--accent); background: #fff0ed; color: #7a2e21; }
.speaker-grid { display: grid; gap: 12px; }
.speaker-card { border: 1px solid var(--line); padding: 18px; border-radius: 6px; }
.speaker-card.issue { border-color: #d46c5b; background: #fff8f6; }
.speaker-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.speaker-id { font-weight: 800; }
.speaker-input { width: min(320px, 100%); min-height: 40px; padding: 8px 10px; border: 1px solid #aeb7bf; }
.sample { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; margin-top: 10px; padding: 12px; background: #f6f8fa; }
.play-button { width: 38px; height: 38px; border: 1px solid #9ca8b3; background: white; font-size: 16px; }
.sample-time { display: block; color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.sample p { margin: 0; line-height: 1.65; }
.issue-row { margin-top: 14px; display: flex; align-items: center; gap: 8px; color: #7a2e21; }
.footer-actions { position: sticky; bottom: 0; margin: 24px -32px -56px; padding: 16px 32px; border-top: 1px solid var(--line); background: rgba(255,255,255,.96); display: flex; justify-content: flex-end; gap: 8px; }
.export-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 20px; }
.export-group { border: 1px solid var(--line); padding: 18px; }
.export-group h3 { margin: 0 0 14px; }
.export-links { display: flex; flex-wrap: wrap; gap: 8px; }
#toast { position: fixed; right: 20px; bottom: 20px; max-width: 360px; padding: 12px 16px; color: white; background: #17202a; opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
#toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 900px) {
  .topbar { padding: 0 18px; }
  .upload-band { grid-template-columns: 1fr; padding: 22px 18px; }
  .workspace { grid-template-columns: 1fr; }
  aside { border-right: 0; border-bottom: 1px solid var(--line); max-height: 260px; overflow: auto; }
  .detail { padding: 22px 18px 96px; }
  .detail-header { display: grid; }
  .speaker-head { align-items: flex-start; flex-direction: column; }
  .speaker-input { width: 100%; }
  .export-grid { grid-template-columns: 1fr; }
  .footer-actions { margin: 24px -18px -96px; padding: 14px 18px; }
}
