:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --panel: #ffffff;
  --panel-strong: #edf2f7;
  --text: #1d252d;
  --muted: #647283;
  --line: #d8e0e8;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --accent-soft: #d9f2ee;
  --warn: #ad3b3b;
  --warn-soft: #f7dfdf;
  --shadow: 0 18px 42px rgba(29, 37, 45, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
select {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin: 0 auto 18px;
  max-width: 1500px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
  line-height: 1.05;
}

h2 {
  font-size: 18px;
}

.progress-panel {
  min-width: 240px;
  color: var(--muted);
  font-weight: 700;
}

.progress-track {
  height: 10px;
  margin-top: 9px;
  overflow: hidden;
  background: var(--line);
  border-radius: 999px;
}

.progress-bar {
  width: 0;
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
  transition: width 180ms ease;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr) minmax(220px, 280px);
  gap: 16px;
  max-width: 1500px;
  margin: 0 auto;
  align-items: start;
}

.queue-panel,
.label-panel,
.export-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.queue-panel,
.export-panel {
  position: sticky;
  top: 16px;
  max-height: calc(100vh - 32px);
  overflow: hidden;
}

.queue-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

.item-list {
  max-height: calc(100vh - 86px);
  overflow: auto;
  padding: 8px;
}

.item-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}

.item-button:hover {
  background: var(--panel-strong);
}

.item-button.active {
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 800;
}

.item-status {
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--line);
}

.item-status.done {
  background: var(--accent);
}

.label-panel {
  min-height: calc(100vh - 126px);
  padding: 22px;
}

.meta-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.meta-label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

code {
  display: inline-block;
  max-width: 100%;
  overflow-wrap: anywhere;
  color: #334155;
  font-size: 13px;
}

.saved-state {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--panel-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.saved-state.done {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.transcript {
  max-width: 920px;
  margin: 28px auto 6px;
  color: #17212b;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 20px;
  line-height: 1.72;
}

.transcript p {
  margin: 0 0 18px;
}

.label-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0 -22px;
  padding: 16px 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.label-form label {
  display: block;
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  border: 1px solid #b7c4d2;
  border-radius: 6px;
}

select:focus,
button:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.25);
  outline-offset: 2px;
}

.actions {
  display: flex;
  gap: 8px;
}

.button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 800;
  white-space: nowrap;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.primary:hover {
  background: var(--accent-dark);
}

.button.secondary,
.button.export {
  background: #fff;
  border-color: #b7c4d2;
  color: #263545;
}

.button.secondary:hover,
.button.export:hover {
  background: var(--panel-strong);
}

.button.danger {
  background: var(--warn-soft);
  color: var(--warn);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.export-panel {
  padding: 16px;
}

.export-panel dl {
  display: grid;
  gap: 10px;
  margin: 18px 0;
}

.export-panel dl div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

dt {
  color: var(--muted);
  font-weight: 700;
}

dd {
  margin: 0;
  font-size: 22px;
  font-weight: 900;
}

.export-panel .button {
  width: 100%;
  margin-top: 8px;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .queue-panel,
  .export-panel {
    position: static;
    max-height: none;
  }

  .item-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(58px, 1fr));
    max-height: 170px;
  }

  .label-panel {
    min-height: auto;
  }
}

@media (max-width: 720px) {
  .app-shell {
    padding: 14px;
  }

  .topbar {
    display: grid;
    align-items: start;
  }

  h1 {
    font-size: 28px;
  }

  .label-panel {
    padding: 16px;
  }

  .meta-row,
  .label-form,
  .actions {
    display: grid;
  }

  .label-form {
    grid-template-columns: 1fr;
    margin: 0 -16px;
    padding: 14px 16px;
  }

  .button {
    width: 100%;
  }

  .transcript {
    font-size: 18px;
    line-height: 1.68;
  }
}
