:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --ink: #18212f;
  --muted: #667085;
  --line: #d9dee8;
  --line-strong: #b9c3d1;
  --accent: #087f73;
  --accent-dark: #075f57;
  --warn: #b45309;
  --danger: #b42318;
  --ok: #067647;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family:
    -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, sans-serif;
  line-height: 1.6;
}

button,
input {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 40px;
  border-right: 1px solid var(--line);
  background: #101828;
  color: #ffffff;
  padding: 32px 24px;
}

.brand-kicker {
  margin: 0 0 10px;
  color: #9ee4d8;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 28px;
  line-height: 1.25;
}

h2 {
  margin-bottom: 4px;
  font-size: 18px;
  line-height: 1.35;
}

.steps {
  display: grid;
  gap: 10px;
}

.step {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 10px 12px;
  color: #cbd5e1;
  font-size: 14px;
}

.step.is-active {
  border-color: #5eead4;
  background: rgba(20, 184, 166, 0.14);
  color: #ffffff;
}

.workspace {
  display: grid;
  gap: 18px;
  align-content: start;
  padding: 24px;
}

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

.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding: 18px 20px;
}

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.upload-form {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: end;
  padding: 20px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span {
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

.field input {
  width: 100%;
  height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  outline: none;
}

.field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(8, 127, 115, 0.14);
}

.drop-zone {
  display: grid;
  gap: 3px;
  min-height: 72px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 13px 14px;
  cursor: pointer;
}

.drop-zone:hover,
.drop-zone.is-dragging {
  border-color: var(--accent);
  background: #f0fdfa;
}

.drop-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.drop-title {
  font-weight: 800;
}

.drop-meta {
  color: var(--muted);
  font-size: 13px;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  border-radius: 8px;
  padding: 0 16px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #ffffff;
}

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

.primary-button:disabled {
  border-color: #98a2b3;
  background: #98a2b3;
  cursor: not-allowed;
}

.ghost-button {
  border: 1px solid var(--line-strong);
  color: var(--ink);
}

.ghost-button.is-disabled {
  pointer-events: none;
  color: #98a2b3;
}

.status-pill {
  border-radius: 999px;
  background: #eef4ff;
  color: #3538cd;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill.is-complete {
  background: #ecfdf3;
  color: var(--ok);
}

.status-pill.is-error {
  background: #fef3f2;
  color: var(--danger);
}

.progress-panel {
  padding-bottom: 18px;
}

.progress-track {
  height: 8px;
  margin: 18px 20px 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e4e7ec;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 240ms ease;
}

.current-step {
  margin: 0;
  padding: 0 20px;
  color: var(--muted);
}

.audio-body {
  display: grid;
  gap: 10px;
  padding: 16px 20px 20px;
}

.audio-body audio {
  width: 100%;
}

.review-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(340px, 0.85fr);
  gap: 18px;
}

.field-list,
.segment-list {
  display: grid;
  gap: 12px;
  max-height: calc(100vh - 344px);
  overflow: auto;
  padding: 16px;
}

.result-card,
.segment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.result-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.result-card h3 {
  margin: 0;
  font-size: 16px;
}

.tag {
  border-radius: 999px;
  background: #f2f4f7;
  color: #344054;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
}

.tag.extracted,
.tag.high {
  background: #ecfdf3;
  color: var(--ok);
}

.tag.empty_needs_review,
.tag.low_confidence,
.tag.low {
  background: #fffaeb;
  color: var(--warn);
}

.tag.skipped_not_voice_extractable {
  background: #f2f4f7;
  color: var(--muted);
}

.value {
  margin-bottom: 10px;
  white-space: pre-wrap;
}

.source-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-list li {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border-left: 3px solid var(--accent);
  background: #f8fafc;
  padding: 8px 10px;
  color: #344054;
  font-size: 13px;
}

.play-ref-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(8, 127, 115, 0.28);
  border-radius: 999px;
  background: #ffffff;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
}

.play-ref-button:hover {
  border-color: var(--accent);
  background: #ccfbf1;
}

.source-body {
  min-width: 0;
}

.source-body p {
  margin: 4px 0 0;
}

.source-link,
.time-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  padding: 0;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.source-link:hover,
.time-link:hover {
  color: var(--accent-dark);
  text-decoration: underline;
}

.segment-card {
  display: grid;
  gap: 6px;
}

.segment-card.is-linked {
  border-color: var(--accent);
  background: #f0fdfa;
  box-shadow: inset 0 0 0 1px rgba(8, 127, 115, 0.18);
}

.segment-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.segment-card p {
  margin-bottom: 0;
}

.empty {
  margin: 0;
  color: var(--muted);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    padding: 22px;
  }

  .steps {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .upload-form,
  .review-grid {
    grid-template-columns: 1fr;
  }

  .field-list,
  .segment-list {
    max-height: none;
  }
}

@media (max-width: 620px) {
  .workspace {
    padding: 14px;
  }

  .steps {
    grid-template-columns: 1fr 1fr;
  }

  .panel-header,
  .upload-form {
    padding: 14px;
  }
}
